P T Withington wrote:Well, it's too bad you did not have a better debugger then ;-).On 2011-04-14, at 11:55, John J. Barton wrote: Based on your solution, the problem isn't the statement or its syntax. At runtime you ended up with an 'undefined'. You did not expect it: there is a bug in some method in the chain that resulted in 'undefined': it should *not* have returned 'undefined' when it did. Given that you have buggy code, what is the best syntax? You could make the argument for syntax that throws: try { var maybe = foo().bar().baz(); // one will fail, we have a bug } catch (exc) { } You could make the argument for defensive programming: var dull = foo(); if (dull) var duller = dull.bar(); if (duller) var dullest = duller. baz(); But given that we have already decided that the use case is "be undefined if your chain is undefined", these are just long winded. So you could make the argument that the Dmitry thing ought to work with the debugger. Rather than a mysterious 'undefined' you should have a a way to rapidly ask the debugger to tell you: which link in the chain is 'undefined'. And that is what you did in your compiler: a good solution to your problem but not an argument against the syntax IMO. jjb |
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

