New private names proposal

Mark S. Miller erights at
Wed Dec 22 11:56:21 PST 2010

On Tue, Dec 21, 2010 at 2:44 PM, Allen Wirfs-Brock <allen at>

> Please don't totally disengage from the syntax discussion.  Most
> programmers understanding of the language starts with the concrete (syntax)
> and then proceeds to the abstract (semantics).  Syntax design can have a big
> impact on the usability of the underlying semantics

Ok, I am not sure what I think of the following idea, but it's a bit
different in flavor and so may stimulate other thoughts. I will express the
expansion in terms of the natural expansion for a soft fields underpinning.
One could do an equally natural expansion for private names. "==>" means
"expands to". Actual expansions would be a bit more complex to preserve the
left-to-right order of evaluation of the original.

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. Finally, given the meaning of the sigil-turned
operator, "@" seemed to read better to me than "#". YMMV.

      expr1 @ expr2

      expr1 @ expr2 = expr3;
      expr2.set(expr1, expr3);

      const obj = {@expr1: expr2, ...};
      const obj = {...}; expr1.set(obj, expr2);

Perhaps the expression on the right need not be a Name/SoftField. It could
be anything that responds to "get" and "set".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list