Nullablity

Brendan Eich brendan at mozilla.org
Thu Jun 22 18:15:59 PDT 2006


Remember, I am in favor of nullability being explicit, "opt in".  I  
also don't think ActionScript 3 or JScript.NET compatibility ties  
ECMA TG1's hands, so let's get that out of the way. Adobe and MS  
people speak up if you feel differently.

On Jun 22, 2006, at 5:36 PM, P T Withington wrote:

> [Anecdote: Curl initially permitted null in its reference types,  
> but under pressure from me (from my experience on the Harlequin  
> Dylan team) changed to a scheme of having to explicitly declare  
> when a type was nullable.  Curl had a large body of existing code  
> where overnight declarations of T went from meaning 'T or null' to  
> strictly 'T'.

Curl requires initialization for let bindings?  (It's hard to tell  
from the online docs I've read.)

>   Very little of the code had to be changed to use the new 'T?'  
> declaration, and in nearly every case where the new declaration was  
> required it was realized that there was previously a potential  
> runtime error due to not checking for null.]

This, I believe -- we have spidered the web looking for uses of JS  
typeof that assume typeof x == "object" means x is not null.  Lots of  
people assume "object" type does not include null.

> I strongly support having types _not_ include null and requiring  
> explicit declaration of nullability.  [Dylan and Curl are two  
> examples of optionally-typed dynamic languages where such a scheme  
> has been successfully implemented.]

I hear you.

/be




More information about the Es4-discuss mailing list