`with` revisited and related to object extension literals
vitteaymeric at gmail.com
Fri Jun 1 04:30:11 PDT 2012
No, you are not alone.
Mustache and cascade are interesting but maybe not extremely, extremely
Then as people have tried since years, I did write too a 'with'-like
proposal in strict mode, I already sent it some time ago and got 0
feedback, maybe I did not present it the right way, it has almost
nothing to do with the usual 'with' (which I find so strange that could
never figure out how this could be used), it's somewhere the contrary,
the concept is about the ability of binding things simply, not about
making incredible mix-up of accessing/defining properties/var/bindings,
so here it is again, not sure it can fit what you want but I have added
more examples to show what it could simplify, and changed the title,
it's not a 'with' revival, but a 'with' redesign, and then if 'with' is
confusing (or not liked) it can be called another name :
It's a modest 'essai' (perfectible, maybe containing wrong or impossible
things) so if it has to be destroyed, please be a little indulgent, at
least I don't think one could say that the concepts behind it are not
Le 01/06/2012 12:09, T.J. Crowder a écrit :
> On 1 June 2012 06:05, Brendan Eich <brendan at mozilla.org
> <mailto:brendan at mozilla.org>> wrote:
> Brendan Eich wrote:
> you're just rehashing a concern based on appearances
> which (I want to be clear; sorry for harshing on the 'with' point)
> is a valid concern. We should discuss it directly, no
> 'with'-semantics mixed in.
> Yes, very useful. I'll stick to things like "to me, the syntax makes
> it look like those identifiers would be resolved via the scope chain"
> and such. Won't mention `with`.
> I'm a bit worried that people may have thought I was being derisive by
> talking about `with`, and that that may have raised hackles. I wasn't.
> I don't think `with` is a flawed concept at all (I recognize many do),
> so I don't use it derisively. I agree with, I think, the majority here
> including (if I'm not mistaken) your own good self that JS's original
> `with` had serious issues, which in my view were down to it using
> freestanding identifiers, intermixing object property resolution and
> scope chain resolution. But I have no problem with the _concept_ in a
> different form.
> So in summary and (largely) in closing:
> 1. I quite like the _idea_ of the cascade proposal, because like Dave
> (I think?) I find the way cascades are currently done (a'la jQuery,
> via `return this`) less than ideal.
> 2. My concerns with it relate to freestanding identifiers and how that
> _looks_. See earlier note to Dave.
> 3. I think that concern can be dealt with without going to a
> `with`-like structure.
> 4. I also think they could be dealt with via a new `with`-like
> structure that did not put an object at the top of the scope chain,
> but instead introduced a placeholder token for the object reference as
> purely syntactic sugar (~. or similar). To me there's a lot of use
> there, including cascades. But I seem to be alone. :-) I find that a
> bit odd, given how similar to that the goals of the cascade sugar seem
> to be, but if I'm on my own, I'm on my own.
> -- T.J.
> es-discuss mailing list
> es-discuss at mozilla.org
Email : avitte at jcore.fr
Web : www.jcore.fr
Webble : www.webble.it
Extract Widget Mobile : www.extractwidget.com
BlimpMe! : www.blimpme.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss