Computer Science question about Scala. The background
information is long but question itself is short on the end.
I will give thumb up, thank you!
In class, we mentioned that developing a static type system for catching run time errors is much harder. Let us try and see what happens.
Let us modify our type grammar to have two different types of numbers: zero and non-zer
with the following subset of Lettuce just involving arithmetic and let bindings:
Goal: Guarantee that a numeric value that receives type ZeroNumType must be 00 and a numeric value that receives NonZeroNumType must always be non-zero.
Semantic Rules:
Constant: The new rule for constants are
Identifiers: The rule for identifiers remains unchanged (see notes).
Plus: The new rules for plus are
Division: The rules for division are
Let Binding: Rules are unchanged (see notes).
We claim that if a Lettuce program is annotated with the types ZeroNumType and NonZeroNumType, and the type annotations are according to the rules above, then any attempt to divide a number by zero will result in typeerror rather than a runtime exception thrown when evaluating the program using an interpreter.
!!!Question!!!:
(B) Point out which rule among the ones provided is incorrect (techically an incorrect type rule is called unsound).
Computer Science question about Scala. The background information is long but question itself is ...
Computer Science question about Scala. The background
information is long but question itself is short on the end.
I will give thumb up, thank you!
In class, we mentioned
that developing a static type system for catching
run time errors is much harder. Let us try and see what
happens.
Let us modify our type
grammar to have two different types of numbers: zero and
non-zer
with the following
subset of Lettuce just involving arithmetic and let bindings:
Goal:
Guarantee...