Re: `with` revisited and related to object extension literals

2012-06-01 Thread T.J. Crowder
On 1 June 2012 03:23, David Herman dher...@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

Re: `with` revisited and related to object extension literals

2012-06-01 Thread T.J. Crowder
On 1 June 2012 06:05, Brendan Eich bren...@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. /be

Re: `with` revisited and related to object extension literals

2012-06-01 Thread Aymeric Vitte
No, you are not alone. Mustache and cascade are interesting but maybe not extremely, extremely usefull. 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,

Re: `with` revisited and related to object extension literals

2012-06-01 Thread David Herman
On Jun 1, 2012, at 2:54 AM, T.J. Crowder wrote: 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

Re: `with` revisited and related to object extension literals

2012-06-01 Thread T.J. Crowder
On 1 June 2012 18:02, David Herman dher...@mozilla.com wrote: I just take issue with the over-broad analogy to `with`. The problem with `with` is that it's statically undecidable whether any variable in the body is bound by the object or by something else in the scope chain. Yeah, at least,

Re: `with` revisited and related to object extension literals

2012-06-01 Thread Brendan Eich
T.J. Crowder wrote: On 1 June 2012 18:02, David Herman dher...@mozilla.com mailto:dher...@mozilla.com wrote: I just take issue with the over-broad analogy to `with`. The problem with `with` is that it's statically undecidable whether any variable in the body is bound by the object

`with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
All, I was going to lurk longer before raising this, and apologies if it's been raised before, but the discussion of object extension literals sort of brought it up. TL;DR: I wonder if the object extension literal might reasonably become a fit-for-purpose `with`. For years I've thought the

Re: `with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
On 31 May 2012 11:33, T.J. Crowder t...@crowdersoftware.com wrote: All, I was going to lurk longer before raising this, and apologies if it's been raised before, but the discussion of object extension literals sort of brought it up. TL;DR: I wonder if the object extension literal might

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Andreas Rossberg
On 31 May 2012 12:52, T.J. Crowder t...@crowdersoftware.com wrote: 2. I originally envisioned this as a statement (of course, I was originally thinking we'd have a new keyword, until the object extension literal discussion), but it could be an expression; if so, presumably the result of the

Re: `with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
On 31 May 2012 12:12, Andreas Rossberg rossb...@google.com wrote: On 31 May 2012 12:52, T.J. Crowder t...@crowdersoftware.com wrote: 2. I originally envisioned this as a statement (of course, I was originally thinking we'd have a new keyword, until the object extension literal

Re: `with` revisited and related to object extension literals

2012-05-31 Thread David Herman
On May 31, 2012, at 4:12 AM, Andreas Rossberg wrote: 4. The leading dot seems, to me, to be more explicit than just having the first symbol on the left being implicitly a property the object. EIBTI I agree with that. As I said in another thread, it's not going to happen because of the ASI

Re: `with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
On 31 May 2012 19:24, David Herman dher...@mozilla.com wrote: On May 31, 2012, at 4:12 AM, Andreas Rossberg wrote: 4. The leading dot seems, to me, to be more explicit than just having the first symbol on the left being implicitly a property the object. EIBTI I agree with that. As I

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Rick Waldron
On Thu, May 31, 2012 at 4:46 PM, T.J. Crowder t...@crowdersoftware.comwrote: On 31 May 2012 19:24, David Herman dher...@mozilla.com wrote: As I said in another thread, it's not going to happen because of the ASI hazard. Dave Expand/link? How does this cause an ASI issue (that can't be

Re: `with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
On 31 May 2012 22:17, Rick Waldron waldron.r...@gmail.com wrote: On Thu, May 31, 2012 at 4:46 PM, T.J. Crowder t...@crowdersoftware.comwrote: On 31 May 2012 19:24, David Herman dher...@mozilla.com wrote: As I said in another thread, it's not going to happen because of the ASI hazard.

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Rick Waldron
Thanks Rick. For lurkers: o.{ foo() // No semi .bar() // Is this o.bar()? or .bar() on the result of foo()? }; I've been following and have read back in the thread, but I'm not seeing a how .bar() would be allowed? Point me in the right direction! Rick

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Brendan Eich
Rick Waldron wrote: Thanks Rick. For lurkers: o.{ foo() // No semi .bar() // Is this o.bar()? or .bar() on the result of foo()? }; I've been following and have read back in the thread, but I'm not seeing a how .bar() would be allowed? In the with example

Re: `with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
On 1 June 2012 00:28, Brendan Eich bren...@mozilla.org wrote: In the with example that Dave gave: with (obj) { foo() // no semi .bar = 12 } it's all allowed as in no syntax error (to correct via ASI) and no restricted production (to make line termination

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Brendan Eich
T.J. Crowder wrote: On 1 June 2012 00:28, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: In the with example that Dave gave: with (obj) { foo() // no semi .bar = 12 } it's all allowed as in no syntax error (to correct via ASI)

Re: `with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
On 1 June 2012 00:51, Brendan Eich bren...@mozilla.org 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

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Brendan Eich
T.J. Crowder wrote: On 1 June 2012 00:51, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org 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

Re: `with` revisited and related to object extension literals

2012-05-31 Thread T.J. Crowder
On 1 June 2012 01:40, Brendan Eich bren...@mozilla.org wrote: Let's be precise. You keep bringing 'with' up but it's not relevant to the cascade proposal, going by Dave's definitions. If you have the appearance of 'with' concern I call out above, let's argue about that. It's a good one (again

Re: `with` revisited and related to object extension literals

2012-05-31 Thread David Herman
On May 31, 2012, at 5:30 PM, T.J. Crowder wrote: On 1 June 2012 00:51, Brendan Eich bren...@mozilla.org 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

Re: `with` revisited and related to object extension literals

2012-05-31 Thread David Herman
On May 31, 2012, at 7:08 PM, T.J. Crowder wrote: On 1 June 2012 01:40, Brendan Eich bren...@mozilla.org wrote: Let's be precise. You keep bringing 'with' up but it's not relevant to the cascade proposal, going by Dave's definitions. If you have the appearance of 'with' concern I call out

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Brendan Eich
T.J. Crowder wrote: On 1 June 2012 01:40, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: Let's be precise. You keep bringing 'with' up but it's not relevant to the cascade proposal, going by Dave's definitions. If you have the appearance of 'with' concern I call

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Brendan Eich
David Herman wrote: 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. So the key here is prototype chain vs. scope chain. 'with' extends the scope

Re: `with` revisited and related to object extension literals

2012-05-31 Thread David Herman
On May 31, 2012, at 9:31 PM, Brendan Eich wrote: This may seem not much of a difference, but it's major not only due to the typo and array-not-an-Array-instance cases. The scope chain extension is costly and forces deoptimization in common implementations. And of course 'with' is banned in

Re: `with` revisited and related to object extension literals

2012-05-31 Thread David Herman
On May 31, 2012, at 9:50 PM, David Herman wrote: ...but it could be captured by the `with` object or one of its properties. s/properties/prototypes/ ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: `with` revisited and related to object extension literals

2012-05-31 Thread David Herman
On May 31, 2012, at 9:50 PM, David Herman wrote: Whereas with cascades, you'd get: var obj = { log: console.log.bind(console), foo: function() { Object.prototype.bar = captured } }; var bar = local variable; with (obj) { log(bar); // local variable

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Brendan Eich
Right, that capture-in-prototype case does not differ due to both cascade desugaring and 'with' searching the head object including its prototype chain. But with a deeper scope chain, and bar not bound in the innermost scope, then 'with' allows an evil interloping function to shadow (or

Re: `with` revisited and related to object extension literals

2012-05-31 Thread Brendan Eich
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. /be ___ es-discuss mailing