New private names proposal
dherman at mozilla.com
Wed Dec 22 23:30:38 PST 2010
MarkM's desugaring doesn't look correct to me at all. Given that names can always be looked up in objects, regardless of whether they are bound with 'private', it is not amenable to simulation via local desugaring. You'd have to change the way square brackets are treated universally. Did you see my message about this earlier in the thread?
----- Original Message -----
From: David-Sarah Hopwood <david-sarah at jacaranda.org>
To: es-discuss at mozilla.org
Sent: Wed, 22 Dec 2010 22:01:39 -0800 (PST)
Subject: Re: New private names proposal
On 2010-12-23 05:08, Brendan Eich wrote:
> On Dec 22, 2010, at 7:34 PM, David-Sarah Hopwood wrote:
>> As far as I can see, MarkM has not (at least, not on the wiki) proposed
>> any new syntax in this discussion that had not already been proposed in
>> one of Allen's proposals.
> Wrong again. Allen did not write the original strawman:names proposal.
Fine, one of Allen or Dave Herman and Sam Tobin-Hochstadt's proposals.
Mea culpa. Does it affect my argument at all? No.
> Follow that link and read http://wiki.ecmascript.org/doku.php?id=strawman:names#binding_private_names
> to see only examples using x.key, etc. -- no square brackets.
What does the lack of an example have to do with anything?
Read what it says: in the scope of 'private x',
"x is also bound as a plain variable to the Name value."
Combined with the previous example:
var name = new Name;
obj[name] = "secret";
print(obj[name]); // secret
it's clear that the square bracket syntax is valid in the scope of a
private declaration. That is what MarkM's desugaring faithfully emulates.
Perhaps that is not what the authors of the names proposal intended.
If so, how was MarkM supposed to know that?
> Mark's example predates private_names and so may have worked in the old
> names proposal,
It explicitly says that it does; there's no "may" here.
> but only via square brackets. Not via dot -- so again *not* "the
> same syntax" as what even strawman:names proposed.
That page doesn't explicitly spell out the desugaring of '.', but MarkM
did so later. There's clearly no conflict with the soft field semantics,
which is the important thing, anyway.
> Never mind the private names proposal that supersedes names -- not faulting
> Mark for lacking clairvoyance here -- I'm faulting you for twisting "the
> same syntax" from its obvious meaning of "all the same syntax" to
> "the subset that uses square brackets".
Only if you're determined to misinterpret it, can
be mistaken for a complete proposal of how to desugar the names syntax.
It is obviously a partial outline.
> You seem to have problem owning up to mistakes.
*I* have a problem owning up to mistakes?
David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com
More information about the es-discuss