On Tue, Jun 19, 2012 at 3:33 PM, Allen Wirfs-Brock <al...@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) 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@mozilla.org https://mail.mozilla.org/listinfo/es-discuss