On 2011-04-13, at 15:23, Brendan Eich wrote: >> >> in my view, the operator is not "?." (i.e. "a question followed by a dot"), >> but still just ?. The following dot is already about property accessor: >> >> foo.bar?.baz >> >> again, bar? is separated, and only after that it's accessed to `baz` via >> casual dot notation. > > ?. is doable as a new operator
And ?( as an operator, too? > , but we need a better quantification of how > useful it is in CS. Or look for the patterns it would simplify in JS? Seems like a lot of these patterns come from duck-typing, from "continue down this path if it applies". On 2011-04-14, at 11:55, John J. Barton wrote: > Perhaps there is no better solution, but often I find that I want to say > "call this chain of functions and use the bottom value, but if any of them > return undefined, then just be undefined, don't get all pissed off and throw > an exception. Being undefined is how JavaScript is." I was imagining that > this was the feature being discussed. This is the way AS2 worked. If at any point an undefined value was hit (whether property access or call), the evaluation stopped and undefined was returned. The experience of OpenLaszlo was that this led to many myserious bugs. We ended up making our compiler insert annotations in debug mode to detect and warn when an expression failed due to an undefined value. That experience makes me believe that the current behavior in ES is a better default; but having a shorthand for "stop now if this is undefined", seems like it would be a nice addition. _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

