You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I no longer think it's a good idea to infer self types (or receiver refinements, for that matter), but we could still use partially-specified self types with class-level type variables to achieve simple extensible programming as in @andongfan's project:
classBase {
self: { eval: 'a-> int } // used when typing methods below// Note that 'a is quantified at the level of the class instance
...
fun eval: (Lit|Add('a, 'a)) -> int
= ...
}
I think this actually helps to clarify the approach, and could be presented as the desugaring of the syntax we show in the SRC extended abstract.
To avoid confusion, we may want to capitalize class-level type variables, as in fun eval: (Lit | Add('A, 'A)) -> int, otherwise one could think the function is polymorphic in it.
Example:
The text was updated successfully, but these errors were encountered: