|
|
|
|
|
by theseoafs
4672 days ago
|
|
I was very excited by this when I read the description, because a compiled language that looks like Ruby is exactly what I've wanted. Unfortunately I'm not super excited by the quirks of the implementation. For example: if some_condition
a = 1
else
a = 1.5
end
If I'm working in a compiled and typed language, the last thing I want is a language that automatically gives union types to variables. As far as I'm concerned, the type inference should fail at this point. In the above example, now I'm forcing the compiler to maintain a union which is going to have a pretty significant overhead on every computation the variable `a` is involved in. |
|
For example, in Scala: val x = if (some_condition) Employer else Employee
If Employer and Employee both derive from Person, then x will be of type Person. The run time uses dynamic dispatch to figure out how members are accessed from x.
If you want to constrain x, you need to specify the type explicitly.