On May 31, 2012, at 5:30 PM, T.J. Crowder wrote:

> 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/
> 
> Thanks. With a great deal of respect, I'm not seeing how that isn't 
> "with-lite" with a magic LHS.

There's no magic at all. The LHS is not an expression; there's no variable 
resolution involved. The problem with `with` is that it captures all variable 
lookups *anywhere* in *any* nested expression. That's not the case with the 
cascade proposal. Furthermore, `with` injects an object into the scope chain, 
so a variable lookup might end up *either* on the object *or* elsewhere in the 
scope chain. Again, not the case here. You can always tell statically which 
parts of the syntax correspond to the object and which things are just 
variables.

I'm not saying I'm 100% enthusiastic about the cascade proposal as is. In fact, 
I think we're wasting a ton of time on this area when we have more important 
things to work on. And no form of mustache is happening in ES6 anyway. It's 
been demoted to strawman; it never had consensus; it's not fully baked.

> 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?

There is *no* mixing of scope and object lookup in the cascade proposal. None 
at all.

> 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?

What Brendan is saying is that the cascades proposal *does* address the broader 
concept: being able to multiple property accesses without having to rename the 
target object, and in a way that doesn't defeat lexical scope. Now, you 
proposed a syntax that doesn't work because of ASI. Then you tossed in a ~ to 
address that. Sorry, but you don't design syntax by throwing more sigils at it 
till it's unambiguous. That way lies line noise.

> 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`,

No, it's just not. There are valid issues with all the variations on 
"mustache," but "being another form of `with`" is not one of them. Some good 
objections have been raised on this thread:

    https://gist.github.com/9a6d60e9c15ac4239b3d

But the problem with `with` is that it screws up lexical scope. *None* of the 
mustache proposals, including the cascades one, screws up lexical scope.

> 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.

Just please stop saying that it's like `with`. It's totally unlike `with`, and 
you'll only confuse people by saying it is. I'm not sure if you've understood 
the intended semantics, but it's simply nothing like `with`. You can disagree 
with the feature, but stick to technically valid arguments.

> (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.)

Hey, no stress -- always happy to have input. Just please, no more bogus 
comparisons to `with`.

Dave

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to