infernu icon indicating copy to clipboard operation
infernu copied to clipboard

Find a way to represent monotyped functions with optional 'this'

Open sinelaw opened this issue 9 years ago • 1 comments

Functions such as:

function f(x) { return x; }

Don't require 'this' and so are generalized over it, to get type forall a. a(b -> b)

Sometimes such functions can't be generalized and become monotypes. In this case, the 'this' argument is locked-down to the first usage's type. Find a way to make it more flexible. (Tried a simple subtyping rule on 'undefined' but that breaks a lot of guarantees)

sinelaw avatar Apr 23 '15 22:04 sinelaw

Probably correct solution is to allow (properly typed) optional params in general.

sinelaw avatar May 18 '15 20:05 sinelaw