Optional argument types

Andreas Rossberg rossberg at google.com
Tue Sep 25 09:18:08 PDT 2012


On 25 September 2012 17:57, John Lenz <concavelenz at gmail.com> wrote:
> One thing that I have seen specifically, is that supporting "non nullable"
> types, and distinguishing between "undefined" and "null" in the type
> signature creates a fair amount of busy work ("type casts" to remove
> nullability) for larger projects.  Although, the provide some level of
> comfort for small projects (where everything is in your control).

Indeed, that is one of the things that is trivial to deal with when
designing a language with types from the very start (where making
types null-free by default is easy and damn useful), and very
difficult when retrofitting types later (where all kinds of weird
patterns might already have evolved).

Regarding null vs undefined in JavaScript, the right thing to do would
probably be making as few distinctions on the type level as possible.

/Andreas


More information about the es-discuss mailing list