Re: Complete Minimal Classes

2012-04-09 Thread Herby Vojčík
Kevin Smith wrote: I always disliked that some functions in ECMAScript 5 can be invoked as either a function or a constructor. What would you want an entity Foo for that can be invoked in two ways? E.g.: new Foo(...) Foo(...) My answer to this is probably a

Array#splice sparse array spec question.

2012-04-09 Thread John-David Dalton
Can someone confirm/reject that by spec (http://es5.github.com/#x15.4.4.12): // sparse array ;D var a=[0]; a[2]=2; // the resulting arrays length should be 1 and not 2 console.log(a.splice(0, 2).length); I'm seeing `2` in latest Chrome/FF. Thanks, -JDD

Re: Questions re. final fat arrow syntax

2012-04-09 Thread Brendan Eich
Axel Rauschmayer wrote: As I've said a couple of times here, we could try again to reach consensus on making () as empty arrow formal parameter list optional, Seems useful, but not worth upsetting anyone over. The issue may not be undiagnosed upset-ness, rather ASI. Leaving out () in front

Re: Complete Minimal Classes

2012-04-09 Thread Jussi Kalliokoski
I think separating [[Call]] and [[Construct]] to different bodies might be a good idea. But to preserve flexibility, I also think that if you do MyClass.call(Object.create(MyClass.prototype)); it should call the [[Construct]]. i.e. if it should use [[Construct]] when 'this' is an instance of the

Re: Complete Minimal Classes

2012-04-09 Thread Kevin Smith
MyClass.call(Object.create(MyClass.prototype)); it should call the [[Construct]]. i.e. if it should use [[Construct]] when 'this' is an instance of the class (inherits from it's prototype). Of course, the above is equivalent to just new MyClass(...) (I think), but I see your point. It may

Re: Array#splice sparse array spec question.

2012-04-09 Thread Allen Wirfs-Brock
This is a spec. bug. Immediately before line10 of the algorithm there should be a line that says: Call the [[Put]] internal method of A with arguments length, actualDeleteCount, and true. The ES3 spec. has the equivalent of the above line. It was apparently inadvertently dropped

Re: Array#splice sparse array spec question.

2012-04-09 Thread Allen Wirfs-Brock
now https://bugs.ecmascript.org/show_bug.cgi?id=332 On Apr 9, 2012, at 8:51 AM, Allen Wirfs-Brock wrote: This is a spec. bug. Immediately before line10 of the algorithm there should be a line that says: Call the [[Put]] internal method of A with arguments length,

Re: Complete Minimal Classes

2012-04-09 Thread Allen Wirfs-Brock
On Apr 7, 2012, at 1:17 PM, Herby Vojčík wrote: I have actually looked at the links (I confess I did not want to browse though another way to ruin (nearly a) consensus on max-min), and I must admit I like it. My reaction to Kevin's initial post was much the same as Herby's. I'm just not

Re: Should ... be suffix rather than prefix?

2012-04-09 Thread Brendan Eich
Kyle Murray wrote: Two dots are (in some contexts) the descendant access operator in E4X, so that might have had something to do with the decision. Even in plain JS without E4X [1], two dots are one way to access prototype methods of a floating point literal: js 42..toString(16) 2a and

Dynamic this

2012-04-09 Thread Herby Vojčík
Hello, this is more a conceptual question post. But first some proposals that circulated in the list: 1. Dynamic-this enabled fat arrow functions. (this, ...) = expr (this, ...) = { body } 2. ABC (apply/bind/call) shortcuts. thisobj::identifier(...args) // apply thisobj::identifier // bind

Re: Dynamic this

2012-04-09 Thread John J Barton
On Mon, Apr 9, 2012 at 10:46 AM, Herby Vojčík he...@mailbox.sk wrote: Hello, this is more a conceptual question post. But first some proposals that circulated in the list: 1. Dynamic-this enabled fat arrow functions. (this, ...) = expr (this, ...) = { body } 2. ABC (apply/bind/call)

Re: Dynamic this

2012-04-09 Thread Russell Leggett
I had been working on a proposal for the bind operator which incorporated short functions, but after consensus was reached on short functions I didn't bother posting it. I think it still has some interesting ideas that you might like. I've posted it here https://gist.github.com/2345080 tl;dr:

Re: Dynamic this

2012-04-09 Thread Angus Croll
I like dynamic this. I favor hard-bound lexical |this| for standalone function calls only. Thats where the problems are right now The (this, ...) syntax seems unnecessarily gnarly - better to just default to using base ref as |this| in a method call - since by now this is expected behavior On

Re: Extra functions on Arrays, Maps, etc..

2012-04-09 Thread Brendan Eich
Erik Arvidsson wrote: Fortunately all the Array.prototype methods are generic so it all just works. Except without a new protocol (opt-in, for backward compat) the pure methods all create a new Array instance to return, not a new NodeList. Is that considered potentially problematic? Allen

Re: Arrow function syntax cover syntax

2012-04-09 Thread David Herman
On Apr 7, 2012, at 1:40 PM, Erik Arvidsson wrote: This does not work for rest parameter since ... is only allowed inside array literals. var tail = (x, ...xs) = xs; This can of course be solved in numerous ways but it is not true that the Expression is a cover grammar for

Re: Arrow function syntax cover syntax

2012-04-09 Thread Russell Leggett
On Mon, Apr 9, 2012 at 5:05 PM, David Herman dher...@mozilla.com wrote: On Apr 7, 2012, at 1:40 PM, Erik Arvidsson wrote: This does not work for rest parameter since ... is only allowed inside array literals. var tail = (x, ...xs) = xs; This can of course be solved in numerous ways

Re: Arrow function syntax cover syntax

2012-04-09 Thread Brendan Eich
Russell Leggett wrote: Or allow it in the grammar and then disallow it in the post-processing. IOW, a cover grammar doesn't have to force us to introduce new syntactic forms, they just force us to put them in the *grammar*. The post-processing, which essentially defines the

Re: callable objects ?

2012-04-09 Thread Brendan Eich
This gist about ClojureScript https://gist.github.com/2346460 reminded me of this thread. I need to spend more time learning ClojureScript; maybe someone who knows it has a thought. /be Irakli Gozalishvili wrote: I have prototyped desugared version of callable objects here:

Re: Extra functions on Arrays, Maps, etc..

2012-04-09 Thread Andrea Giammarchi
I keep finding the frame problem overrated, specially in this case where the case you are passing DOM nodes between frames is ... well, extremely edge? If NodeList.prototype is instanceof Array then this check is all you need before Array.isArray(nl) but generally speaking I agree is never that