Inferny Infernu . I hope I don’t have to change the name again!
In other news, here is some recent progress:
‘new’ now requires ‘this’ to be a row type
I changed inference of ‘new’ calls, so that the constructed function must have a row type as it’s “this” implicit parameter (nothing else makes sense).
new String(3) == '3' but at the same time,
new String(3) !== '3'.
I added an initial implementation of what I call ambiguous types. These are simple type constraints that limit a type variable to a set of specific types.
With the new type constraints, + has the following type:
a = (TNumber | TString) => ((a, a) -> a)
The syntax is reminiscent of Haskell’s type classes, and means: given a type variable “a” that is either a
TNumber or a
TString, the type of + is:
(a, a) -> a
I’m thinking about implementing full-blown type classes, or alternatively, a more powerful form of ambiguous types, to deal with some other more complicated examples.