Re: Self-recursion and arrow functions

2013-03-17 Thread Claus Reinke
I understand, but it's still a limitation of arrow functions that they rely on arguments.callee to self-reference. Relying on the defined name they're assigned to suffers from the "can be redefined" problem. NFE's don't suffer this problem and can completely avoid `arguments` in ES6 for all use ca

Re: Self-recursion and arrow functions

2013-03-17 Thread Jorge Chamorro
On 17/03/2013, at 10:43, Claus Reinke wrote: >> I understand, but it's still a limitation of arrow functions that they rely >> on arguments.callee to self-reference. Relying on the defined name >> they're assigned to suffers from the "can be redefined" problem. NFE's >> don't suffer this problem a

Re: Self-recursion and arrow functions

2013-03-17 Thread Jason Orendorff
On Sun, Mar 17, 2013 at 2:43 AM, Claus Reinke wrote: > Neither arguments.callee (not available in strict) nor let (clumsy to > use in expressions) are needed for self-reference > >var rec = (f) => f((...args)=>rec(f)(...args)); > >var f = (self)=>(n)=> n>1 ? n*self(n-1) : n; > >[1,2,3,

Re: Self-recursion and arrow functions

2013-03-17 Thread Jorge Chamorro
On 17/03/2013, at 12:16, Jason Orendorff wrote: > On Sun, Mar 17, 2013 at 2:43 AM, Claus Reinke wrote: > Neither arguments.callee (not available in strict) nor let (clumsy to > use in expressions) are needed for self-reference > >var rec = (f) => f((...args)=>rec(f)(...args)); > >var f

Re: Self-recursion and arrow functions

2013-03-17 Thread Kevin Smith
> > Sorry arrow functions but this isn't a better JS. > Bah. Arrow functions are a huge usability win for JS. Try them- you'll see! { Kevin } ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Self-recursion and arrow functions

2013-03-17 Thread Mark S. Miller
Just in case anyone does not realize that this thread is humorous, const factorial = n => n>1 ? n*factorial(n-1) : 1; Yes, you can't use this as an expression. So what? After this declaration you can use factorial as an expression. Anonymous lambda expressions are a wonderful things. But in a

Re: Self-recursion and arrow functions

2013-03-17 Thread Axel Rauschmayer
;-) How about the following (about which I’m serious)? function defineRec(f) { return args => f(f, ...args); } let factorial = defineRec((me, n) => n <= 1 ? 1 : n * me(me, n-1)) On Mar 17, 2013, at 14:33 , "Mark S. Miller" wrote: > Just in case anyone does not realize that this thread i

Re: On Scope And Prototype Security

2013-03-17 Thread David Bruant
Hi Andrea, I'm really having a hard time understanding where the security issue is here. From what I understand, you've properly hidden the "Private" constructor. I am not surprised if code can reach the [[Prototype]] of an instance and I wouldn't consider that a flaw. I would consider that th

Constructors need to be able to recognize uninitalized instances(?)

2013-03-17 Thread Axel Rauschmayer
[Referring to Allen’s slides: http://wiki.ecmascript.org/lib/exe/fetch.php?id=meetings%3Ameeting_jan_29_2013&cache=cache&media=meetings:subclassing_builtins.pdf ] Is this really true? I can see four ways of invoking a constructor function C: 1. As a function: C(...) 2. Via `new`: new C(...) 3.

Re: On Scope And Prototype Security

2013-03-17 Thread Andrea Giammarchi
My concern is about being unable to let "anyone" retrieve that property, for introspection or to pollute it or change it being able to make my private constructor insecure. In the example there but in other situation I cannot freeze the prototype and yet I cannot hide it from outside in a meaningfu

Re: Self-recursion and arrow functions

2013-03-17 Thread Brandon Benvie
This is probably the most humor I've ever seen on esdiscuss. On Mar 17, 2013, at 6:33 AM, "Mark S. Miller" wrote: > Just in case anyone does not realize that this thread is humorous, > > const factorial = n => n>1 ? n*factorial(n-1) : 1; > > Yes, you can't use this as an expression. So wh

Re: get/setIntegrity trap (Was: A case for removing the seal/freeze/isSealed/isFrozen traps)

2013-03-17 Thread Tom Van Cutsem
Hi, Allen's latest draft (Rev. 14) contains the change where [[Freeze]],[[Seal]] and [[PreventExtensions]] have been consolidated into [[HasIntegrity]]/[[SetIntegrity]]. While no changes were made to the Proxy API (i.e. no has/getIntegrity traps yet), the definition of Object.{freeze,seal,preventE

Re: On Scope And Prototype Security

2013-03-17 Thread David Bruant
Le 17/03/2013 18:09, Andrea Giammarchi a écrit : My concern is about being unable to let "anyone" retrieve that property, for introspection or to pollute it or change it being able to make my private constructor insecure. In the example there but in other situation I cannot freeze the prototype

Re: get/setIntegrity trap (Was: A case for removing the seal/freeze/isSealed/isFrozen traps)

2013-03-17 Thread André Bargull
The incompatibility you've noticed is just a spec bug in [[HasIntegrity]]. In step 2a of 8.3.3, the value of [[Extensible]] needs to be inverted. With that change applied, the code snippet will return `true`. - André Hi

Re: get/setIntegrity trap (Was: A case for removing the seal/freeze/isSealed/isFrozen traps)

2013-03-17 Thread Allen Wirfs-Brock
Tom recently suggested that that we really don't need MOP-level or trap operations from freezing, sealing and testing those states. Also, there seems to be minimal support for having explicit freeze/sealed integrity states or for adding integrity integrity states. So I'm probably going to go m

Re: Self-recursion and arrow functions

2013-03-17 Thread Allen Wirfs-Brock
I don't think anybody has yet exploited the power of parameter default values for defining recursive functions: ((fact=n=>n>1 ?n*fact(n-1):1)=>(fact))() Allen On Mar 17, 2013, at 7:39 AM, Axel Rauschmayer wrote: > ;-) > > How about the following (about which I’m serious)? > > function de

Re: Self-recursion and arrow functions

2013-03-17 Thread Axel Rauschmayer
Nice (in an IIFE-kind of way). If we had `do` expressions, the following would also be possible (producing an expression that could be assigned anywhere and to anything): do {let fact = n=>n>1 ?n*fact(n-1):1} I’m assuming that the completion value of a let declaration is the rhs of the las

Re: Object.is steps are very thing

2013-03-17 Thread Rick Waldron
On Sat, Mar 16, 2013 at 7:56 PM, Allen Wirfs-Brock wrote: > > On Mar 16, 2013, at 4:42 PM, Tom Schuster wrote: > > > I would argue that the disclaimer makes this more confusing. I am > > aware of the behavior that not passed parameters are undefined. But It > > sounded like we would never execute

Re: On Scope And Prototype Security

2013-03-17 Thread Andrea Giammarchi
David I do not use, neither have a problem, with the example code but I have used runtime prototype changes for state-machine like applications. It is not possible to secure or make a class hidden, it was possible before the introduction of __proto__ and Object.getPrototypeOf in ES3, now this is g

Re: Self-recursion and arrow functions

2013-03-17 Thread Jorge Chamorro
On 17/03/2013, at 14:33, Mark S. Miller wrote: > Just in case anyone does not realize that this thread is humorous, > > const factorial = n => n>1 ? n*factorial(n-1) : 1; > > Yes, you can't use this as an expression. So what? After this declaration you > can use factorial as an expression.

Re: Constructors need to be able to recognize uninitalized instances(?)

2013-03-17 Thread Axel Rauschmayer
Thanks! > awbjs IOW, I’d write the check: if (typeof this !== "object" || !($fooBrand > in this) || this[$fooBrand]) /*CAAF*/ > > perhaps: if ( this ===null || typeof this !== "object" || > this[$fooBrand]!==undefined) /*CAAF*/ > if depends upon how the @@create method chooses to use as an "u

Re: Constructors need to be able to recognize uninitalized instances(?)

2013-03-17 Thread Axel Rauschmayer
> if ( this ===null || typeof this !== "object" || this[$fooBrand] !== > false) /*CAAF*/ > > Then the last Or operand is true if either the instance has already been > initialized or if `this` is an object that does not have a property whose key > is $fooBrand (e.g. a namespace object). In

Re: Self-recursion and arrow functions

2013-03-17 Thread Rick Waldron
On Sun, Mar 17, 2013 at 7:10 PM, Jorge Chamorro wrote: > On 17/03/2013, at 14:33, Mark S. Miller wrote: > > > Just in case anyone does not realize that this thread is humorous, > > > > const factorial = n => n>1 ? n*factorial(n-1) : 1; > > > > Yes, you can't use this as an expression. So what?

Re: Self-recursion and arrow functions

2013-03-17 Thread Matthew Robb
I know I am late to this party and I am not sure how serious it even is but can someone help me understand why function expressions require anything special to denote the fact that it's a function? ` requestAnimationFrame(onFrame(time) { }) ` The following seems a pretty convenient side benefit:

Re: Self-recursion and arrow functions

2013-03-17 Thread Jorge Chamorro
On 18/03/2013, at 01:49, Rick Waldron wrote: > snip > ...and Brendan's point about backwards compatibility is irrefutable: > > https://mail.mozilla.org/pipermail/es-discuss/2012-January/019860.html > snip How is ƒ fib(n) { ... } any more backwards incompatible than const fib = (n) => { ... };

Re: Self-recursion and arrow functions

2013-03-17 Thread Rick Waldron
On Sun, Mar 17, 2013 at 9:54 PM, Jorge Chamorro wrote: > On 18/03/2013, at 01:49, Rick Waldron wrote: > > > snip > > ...and Brendan's point about backwards compatibility is irrefutable: > > > > https://mail.mozilla.org/pipermail/es-discuss/2012-January/019860.html > > snip > > How is > > ƒ fib(n)

Re: Self-recursion and arrow functions

2013-03-17 Thread Rick Waldron
On Sun, Mar 17, 2013 at 9:50 PM, Matthew Robb wrote: > I know I am late to this party and I am not sure how serious it even is > but can someone help me understand why function expressions require > anything special to denote the fact that it's a function? > > ` > requestAnimationFrame(onFrame(tim

Four static scoping violations in ES5 sloppy

2013-03-17 Thread Domenic Denicola
I went back to this old es-discuss thread: http://www.mail-archive.com/es-discuss@mozilla.org/msg18408.html which references a video segment from Mark Miller: http://www.youtube.com/watch?v=Kq4FpMe6cRs&t=42m53s giving four static scoping violations: 1. implicit global variable creation 2. `wit