3 ms·
That's a common problem with globally inferencing compilers, you strictly cannot know who's right about a type. I think that's a good reason to prefer a langua
by Nitramp 11y ago
That's a common problem with globally inferencing compilers, you strictly cannot know who's right about a type.
I think that's a good reason to prefer a language with local type inference, but no type inference across function boundaries. It saves you from too much boiler plate to type and has (IMHO) better developer ergonomics.
- renox 11y agoIn Jay (a language not finished) there is a prefix for the parameter who is the 'master' type (if memory serves '$'), this has the following benefits: -in fun f(a:$T, b:T) and f(1, 'hello') you can say Error parameter 'b' is a string but generic type T is int as defined by parameter 'a'. -no need to have a separate definition of generic types as in fn f<T>(a:T): fn f(a:$T) tells you already which type is generic.