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.
.{...} has established ways to do things, like .{"0":"foo", "1":"bar"}
(and recently it even had .{[key]:value}).
I cannot see how would you do this in .(...)? .([0]="foo"; [1]="bar")?
Or you introduce .["foo", "bar"]?
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).
/be
Herby
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss