On Apr 14, 2011, at 5:19 PM, Brendan Eich wrote: > On Apr 14, 2011, at 8:59 PM, P T Withington wrote: > >> 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? > > That would seem to want a bottom up parser. Consider > > (a?(b instanceof c):d) > > vs. > > (a?(b instanceof c)) > > A top-down parser could simulate by parsing ahead assuming ?:, and in the > second case on finding no : where expected, revise the AST for the prefix > that was already parsed. This looks nasty, and it needs more rigorous > validation.
I'm not convinced this would be too difficult to handle, at least in a hand written parser. That said I'm not endorsing the syntax as I think that historically languages that are "hard" to parse are also hard to understand, I'm just commenting on implementation difficulty. --Oliver _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

