New private names proposal

David-Sarah Hopwood david-sarah at jacaranda.org
Thu Dec 23 16:46:02 PST 2010


On 2010-12-24 00:11, David Herman wrote:
> On Dec 23, 2010, at 5:03 PM, David-Sarah Hopwood wrote:
> 
>> On 2010-12-23 23:55, David Herman wrote:
>>> On Dec 23, 2010, at 4:27 PM, David-Sarah Hopwood wrote:
>>> 
>>>> We don't know whether [] will be changed at all. (In the proposal to
>>>> add a @ or .# operator, it isn't.)
>>> 
>>> Hm, this looks like a pretty serious misunderstanding of the private
>>> names proposal.
>> 
>> I was not referring to the private names proposal, but to the more
>> recent suggestions from various people to add a @ or .# operator instead
>> of changing []. (I should not have referred to those suggestions as a
>> proposal. Careless editing, sorry.)
> 
> a) I don't recall seeing people suggesting adding a .# operator instead of 
> changing '[]', but rather instead of changing '.'.

Lasse Reichstein did so:

# Mark Miller wrote:
#> Currently is JS, x['foo'] and x.foo are precisely identical in all
#> contexts. This regularity helps understandability. The terseness
#> difference above is not an adequate reason to sacrifice it.
#
# Agree. I would prefer something like x.#foo to make it obvious that it's
# not the same as x.foo (also so you can write both in the same scope), and
# use "var bar = #foo /* or just foo */; x[#bar]" for computed private name
# lookup. I.e. effectively introducing ".#", "[#" as alternatives to just "."
# or "[".

MarkM responded with a similar proposal, using a single operator:

# The basic idea is, since we're considering a sigil anyway, and
# since .# and [# would both treat the thing to their right as something
# to be evaluated, why not turn the sigil into an infix operator instead?
# Then it can be used as "."-like "[]"-like without extra notation or
# being too closely confused with "." or "[]" themselves. [...]

> b) You're shifting the terms of the debate anyway. You can't decide for
> yourself what you want others to propose so you can argue with your
> favorite strawman.

As shown above, I haven't.

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101224/b4bd1fc2/attachment.bin>


More information about the es-discuss mailing list