On 1 June 2012 00:51, Brendan Eich <[email protected]> wrote:
> Dave's cascade proposal:
>
> http://blog.mozilla.org/**dherman/2011/12/01/now-thats-**a-nice-stache/<http://blog.mozilla.org/dherman/2011/12/01/now-thats-a-nice-stache/>
Thanks. With a great deal of respect, I'm not seeing how that isn't
"with-lite" with a magic LHS. Indeed, how is it less confusing (and less
implicit) than the existing `with`? Re the recurring array example: Which
`pop` is it? One specific to the object? A local? Something in the
containing scope? A global? Why is the magic constrained to the LHS?
I believe it's a mistake to theory-patch, however. You were following the
> reform-with path which leads to leading dot. Then the ASI (lack of it, as
> usual -- "nega-ASI" :-P) problem reared its head. Then you mooted ~. This
> approach has a smell, in science and engineering. I say this without
> meaning offense again, since I've done it myself (especially in code, so
> there's a code patch too -- and technical debt if not a user-facing "noise"
> spike).
I'm not seeing (smelling?) a smell. Making free symbols be implicit
property lookups has an error-prone history (vis: `with` as-was), so my
thought was: Make it explicit. I'm not by far the first. Dave pointed out
that ASI causes an issue with the specific syntax I mentioned, so I
addressed that -- while making the point that the specific syntax was not
the main thrust of the argument. Surely we can respond to reasonable
syntactic flags without invalidating the broader concept?
All of which is somewhat beside the point. The main point is that it seems
like the object extension literal proposal (esp. when combined with the
cascade proposal) is another form of `with`, with similar issues, plus some
confusion with object initializers. My main point is: Perhaps the issues
arising are in part because of the magic, and perhaps either A) Making it
explicit helps, or B) The magic ain't worth it.
Let's take another look:
var foo = "bar";
this.{
foo = "baz"
yow = "hello"
baz = foo
};
What's `foo`? Is it still "bar" or is it "baz"? What's `this.baz`? Is it
"bar" or "baz" or did the code throw or...? Contrast with:
var foo = "bar";
this.{
~.foo = "baz";
~.yow = "hello";
~.baz = foo;
};
EIBTI. No confusion between foo and ~.foo. There's a distinction between
being explicit, being clear, and adding noise.
Again I want to emphasize that the precise syntax is not the point. It
could be "~" or ">" or "^" or any of several other things instead of "~".
(I quite like the ~, though, as it happens.) Being explicit, and deciding
to either do, or not do, `with`-lite, is the point.
(And I want to emphasize that I'm clear I'm a newcomer amongst giants,
although not remotely a newcomer to designing solutions; and I have a lot
of respect for the giants in the room. Just trying to contribute, to be
helpful; not to be difficult.)
-- T.J.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss