Existential operator (was: ||= is much needed?)

Brendan Eich brendan at mozilla.org
Tue Jun 19 15:53:58 PDT 2012

Indeed I did not spec this in 
-- one step at a time. Also I'm not sure how the indefinite soak will 
fly with others on TC39.

Allen, I agree if we do make a soak and don't spec it as CoffeeScript 
realizes it (by translation!) then we're looking at elaborating 
Reference semantics. Still smells, but it's the only plausible path if 
this is the goal.

More when I have time. Thanks for the feedback.


Jeremy Ashkenas wrote:
> On Tue, Jun 19, 2012 at 3:33 PM, Allen Wirfs-Brock 
> <allen at wirfs-brock.com <mailto:allen at wirfs-brock.com>> wrote:
>     >  foo.bar?(args) <==>  foo.bar?.call(foo, args)
>     >  fun?(args) <==>  fun?.call(undefined, args)
>     How are these equivalent? Won't  fun?.call evaluate to undefined
>     if fun is undefined and undefined(undefined,args) will throw...
>  ... check out the compilation:
> http://coffeescript.org/#try:fun%3F.call(undefined%2C%20args)%0A%0Awindow.method%3F.call(window%2C%20args) 
> <http://coffeescript.org/#try:fun%3F.call%28undefined%2C%20args%29%0A%0Awindow.method%3F.call%28window%2C%20args%29>
> It doesn't eagerly evaluate to undefined ... the value of the *entire* 
> expression is undefined if the chain is broken at the existential 
> operator. That's much of the point of soaks:
> object.property?.i.can.keep.chaining.in.here.without.throwing.errors.if.property.is.undefined 
>  ;)
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

More information about the es-discuss mailing list