More fun with undefined

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Jun 14 15:29:50 PDT 2012


On Jun 14, 2012, at 3:10 PM, T.J. Crowder wrote:

> Making a point of making this a separate thread from the current ?? and ??= thread(s), which are thankfully looking close to consensus. So that's infix and assignment.
> 
> Question: Should we consider unary as well?
> 
> I ask because I went searching through my code (and others') to see where I'd get a lot of use out of ?? and ??=, and I will, but I also found a **lot** of:
> 
> // 1
> if (typeof foo === "undefined") { // Or foo === undefined
>     // ...
> }

This is a different issue, but I wonder how badly the web would break if we made undefined a reserved word.  Does anybody in JS really declare a different local binding for undefined?  In ES5 we got away with making undefined read-only.  Maybe we should continue pushing and see if we can eliminate the rebindable undefined hazard. 

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120614/2a895e34/attachment.html>


More information about the es-discuss mailing list