`with` revisited and related to object extension literals

T.J. Crowder tj at crowdersoftware.com
Fri Jun 1 02:54:47 PDT 2012

On 1 June 2012 03:23, David Herman <dherman at mozilla.com> wrote:

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

You're talking the technical details. I'm talking appearance and
expectation in the eyes of developers.

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


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

Could we please avoid derogatory terms like "bogus"? I'm talking about what
people see when they look at code (more below). That's a valid argument.
You can disagree with it without deriding it.

You're quite right that I shouldn't have said it __acts__ like `with`,
because of course, it's been clearly defined not to. I should have said
that it looks like it acts like it, or just better yet just stuck with
"looks." Sorry, it was late.

On 1 June 2012 03:30, David Herman <dherman at mozilla.com> wrote:

> This is a misunderstanding. There's no such thing as "free symbol
> resolution." There are "free variables" and there is "variable resolution"
> but "free symbol resolution" doesn't mean anything.

I should have said "token", or possibly "identifier," not "symbol".

In the cascade proposal, the LHS of each item *contains no variables*.

I didn't say it did.

> Now the cascade:
> array.{
>     pop()
>     pop()
> };
> That looks like `with`, it acts like `with`,
> No, it doesn't, and it would be really helpful if you would try to
> understand why it doesn't.

I _do_ understand how you want it to work, how you've defined it. I'm clear
on that: The identifiers are property names, looked up on the object in
question in the usual way; they are not to be resolved by the scope chain.
A freestanding `foo` outside the mustache is completely unrelated to a
freestanding `foo` within the mustache. I get it.

I'm saying that's not what I see when I look at it, and not what I think
most developers will see, because -- and correct me if I'm wrong, it's
certainly been known! -- the only other place where that's true is an
object initializer, isn't it? I believe everywhere else, an identifier that
isn't a reserved word, standing free, is resolved via the scope chain.
Object initializers look enough unlike step-by-step code (even though they
are processed in source order) that they aren't confusing.

Apologies for apparently having given the impression I didn't understand
how you defined cascades to work. We could have avoided some wasted time if
I'd made that clear.

If the cascade proposal is not going forward in its current form any time
soon, let's shelve this conversation. Bigger fish to fry, as you said. If
you'd like the final word, though, I'm happy for you to have it.

-- T.J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120601/eb73ae09/attachment.html>

More information about the es-discuss mailing list