Jürg Lehni wrote:
On 30 Jun 2010, at 19:13, Brendan Eich wrote:
Some of us old-timers were around at Netscape with Norris Boyd when this was
designed and added to Rhino. It was not added to SpiderMonkey, though, for not
terribly compelling reasons.
Do you remember what the reason was why this was added to Rhino in the first
place? Was it to facilitate Java-like syntax when implementing interfaces? I
remember seeing examples with such code quite a while ago, triggering me
playing around with the feature and finding out that the object is simply
passed as a last added argument. I did not manage to find any example code that
somehow makes reference to this recently though, so I am wondering if the Rhino
people are maybe trying to get rid of this too on the long term? After all it
is not proper ES syntax, and for example Eclipse's syntax checker is
complaining about it.
I remember being concerned about the ASI issue, which requries a [no
LineTerminator here] restricted production. That is still a concern: the TC39
committee doesn't want to add restricted productions without very good reason.
This came up later, via https://bugzilla.mozilla.org/show_bug.cgi?id=253138 -- see
https://bugzilla.mozilla.org/show_bug.cgi?id=253138#c7.
https://bugzilla.mozilla.org/show_bug.cgi?id=253138#c10 suggests an operator of some sort
to "merge" the objects.
Another point to note is that [1,2,3] is not equivalent to new Array(3) {0:1,
1:2, 2:3}, because the array initialiser form users the original value of
Array.prototype, and it does not call the current binding of Array as a
constructor.
So, more work needed to avoid a restricted production, at least. A linking operator or
keyword ("with" a la functional record update) would help.
This is all very interesting. An operator would make the feature even more
useful, as it would not be bound to the calling of a constructor. Could a
simple : work? E.g.:
new Array(3) : { 0:1, 1:2, 2:3 };
Jürg
boolVal ? new Array(3) : { 0:1, 1:2, 2:3 };
Completely different result... I think that syntax would cause confusion.
--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss