Rick Waldron wrote:
On Wednesday, May 30, 2012 at 12:09 AM, Brendan Eich wrote:
Brendan Eich wrote:
The only usable+secure extensions I see are two, so we don't confuse
users with almost-identical syntax with quite different (when it
matters most, when under attack) semantics:
A. obj.{prop: val, ...} as safe mustache, with : for define not assign.
B. obj.[prop = val; ...] with meta... of course, for fluent-style
chained assignments of obj's props.
I use [ not { for the chained case so the bracketing as well as
;-separation (final ; is optional) and = not : distinguish B from A
for readers looking at any punctuation.
Stop me if you've heard this one before...
For B, instead of [] we could use () as the chained set/call brackets.
E4X (ECMA-357) defines xml.(expr) as a filtering predicate expression,
but no worries, E4X is going away.
Comments welcome on the idea of avoiding using { for something that is
neither a start-object-literal (in B) nor a block (contents are quite
constrained).
Would property assignments be separated by comma or semicolon?
Eg.
o.( a = "alpha", b = "beta" )
v.
o.( a = "alpha"; b = "beta" )
Heh, I didn't say. Comma might be just as good meaning "no worse than
semicolon" in light of object literals having different-enough brackets.
Comma looks like the comma operator, and with () around it looks like an
argument list, OTOH.
On the principle of making different semantics look different, I'd go
with ; over , at this point. But perhaps there' s a more targeted
argument one way or the other?
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss