Re: Membranes, unmediated access to objects through Object.getPrototypeOf

2012-10-10 Thread David Bruant
2012/10/10 David Bruant bruan...@gmail.com About making the restriction for membranes official could be done by introducing branded proxies which output values (through get/getOwnPropertyDescriptor/getPrototypeOf... traps) would also be branded proxies (with the same brand). Brand validation

undefined cast to a string with regex test

2012-10-10 Thread gaz Heyes
This wasn't totally unexpected but seriously made me go WTF. It appears that arguments to regexp.test are cast to a string. This was bad for me since I was writing a js parser at the time and checking the argument to see if it matched one of the reserved words. See the example below:-

Re: undefined cast to a string with regex test

2012-10-10 Thread Rick Waldron
On Wednesday, October 10, 2012 at 6:19 AM, gaz Heyes wrote: This wasn't totally unexpected but seriously made me go WTF. It appears that arguments to regexp.test are cast to a string. This was bad for me since I was writing a js parser at the time and checking the argument to see if it

Exception: parameter(s) with default followed by parameter without default

2012-10-10 Thread David Bruant
Hi, I've tried the following on Firefox: function f(a, b = 34, c){ console.log('b', b) } f(1, undefined, 43) and got Exception: parameter(s) with default followed by parameter without default It seems intentional, but I wonder why it's been decided this way. It seems that default

Re: Exception: parameter(s) with default followed by parameter without default

2012-10-10 Thread Keith Cirkel
You /are/ actually passing in a second argument though, your second argument is `undefined`. Default arguments aren't meant to replace `undefined` values, they're meant to be permissible for omission. -- Keith Cirkel On 10 October 2012 14:19, David Bruant bruan...@gmail.com wrote: Hi, I've

Re: issue: function hoisting and parameter default value initialization

2012-10-10 Thread Andreas Rossberg
On 9 October 2012 01:55, Brendan Eich bren...@mozilla.org wrote: Andreas Rossberg wrote: Let me try again. How about the following desugaring? function f(x1 = e1, ~~~, xN = eN) { body } means function f(x1, ~~~, xN) { if (x1 === undefined) x1 = e1; ~~~ if (xN ===

Re: Exception: parameter(s) with default followed by parameter without default

2012-10-10 Thread David Bruant
2012/10/10 Keith Cirkel es-disc...@keithcirkel.co.uk You /are/ actually passing in a second argument though, your second argument is `undefined`. Default arguments aren't meant to replace `undefined` values, they're meant to be permissible for omission. From

Re: issue: function hoisting and parameter default value initialization

2012-10-10 Thread Allen Wirfs-Brock
On Oct 10, 2012, at 6:33 AM, Andreas Rossberg wrote: On 9 October 2012 01:55, Brendan Eich bren...@mozilla.org wrote: Andreas Rossberg wrote: Let me try again. How about the following desugaring? function f(x1 = e1, ~~~, xN = eN) { body } means function f(x1, ~~~, xN) { if

Re: Exception: parameter(s) with default followed by parameter without default

2012-10-10 Thread Allen Wirfs-Brock
On Oct 10, 2012, at 6:19 AM, David Bruant wrote: Hi, I've tried the following on Firefox: function f(a, b = 34, c){ console.log('b', b) } f(1, undefined, 43) and got Exception: parameter(s) with default followed by parameter without default It seems intentional, but

Re: Exception: parameter(s) with default followed by parameter without default

2012-10-10 Thread Allen Wirfs-Brock
On Oct 10, 2012, at 6:39 AM, David Bruant wrote: 2012/10/10 Keith Cirkel es-disc...@keithcirkel.co.uk You /are/ actually passing in a second argument though, your second argument is `undefined`. Default arguments aren't meant to replace `undefined` values, they're meant to be permissible

Function.length and Default Parameters

2012-10-10 Thread Kevin Smith
I notice that the current draft spec says: The ExpectedArgumentCount of a FormalParameterList is the number of FormalParameters to the left of either the rest parameter or the first FormalParameter with an Initialiser. This aligns ExpectedArgumentCount with built-in functions like

Re: Function.length and Default Parameters

2012-10-10 Thread Allen Wirfs-Brock
ExpectedArgumentCount is used to the the length property of function objects. We've discussed this extensively before and there doesn't seem to be many plausible use cases for the function length property. Given that length isn't very useful alignment with the conventions used for the

Re: Exception: parameter(s) with default followed by parameter without default

2012-10-10 Thread Oliver Hunt
On Oct 10, 2012, at 9:12 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Oct 10, 2012, at 6:39 AM, David Bruant wrote: 2012/10/10 Keith Cirkel es-disc...@keithcirkel.co.uk You /are/ actually passing in a second argument though, your second argument is `undefined`. Default

Re: Function.length and Default Parameters

2012-10-10 Thread Kevin Smith
We've discussed this extensively before and there doesn't seem to be many plausible use cases for the function length property. Here's the only use case that I've encountered (admittedly not particularly strong): Overriding the behavior of a function/method based on the signature of an input

Re: Exception: parameter(s) with default followed by parameter without default

2012-10-10 Thread Brendan Eich
Oliver Hunt wrote: On Oct 10, 2012, at 9:12 AM, Allen Wirfs-Brock al...@wirfs-brock.com mailto:al...@wirfs-brock.com wrote: On Oct 10, 2012, at 6:39 AM, David Bruant wrote: 2012/10/10 Keith Cirkel es-disc...@keithcirkel.co.uk mailto:es-disc...@keithcirkel.co.uk You /are/ actually

Re: issue: function hoisting and parameter default value initialization

2012-10-10 Thread Brendan Eich
Agreed, desugaring is helpful for checking intuition or a design idea but it can be the wrong tool for the job. Main thing we should discuss is Andreas's idea of a separate scope for parameter default expressions, shadowed by the function's body scope. /be Allen Wirfs-Brock wrote: On Oct

Re: Membranes, unmediated access to objects through Object.getPrototypeOf

2012-10-10 Thread Tom Van Cutsem
2012/10/10 David Bruant bruan...@gmail.com Having this uniqueness invariant is what enforces graph isomorphism. In a nutshell, unlike the current proposal, traps can still return proxies, but it has to be the exact proxy that can be returned is decided in advanced, pretty much like the

Re: Membranes, unmediated access to objects through Object.getPrototypeOf

2012-10-10 Thread David Bruant
2012/10/10 Tom Van Cutsem tomvc...@gmail.com 2012/10/10 David Bruant bruan...@gmail.com Having this uniqueness invariant is what enforces graph isomorphism. In a nutshell, unlike the current proposal, traps can still return proxies, but it has to be the exact proxy that can be returned is

Re: should we rename the Program grammar production?

2012-10-10 Thread Brendan Eich
Allen Wirfs-Brock wrote: I proposed that we replace Program in this context with Script. This is much less confusing and matches the most common manifestation of an ES Program as an HTML script block. +1 -- it the term at least some engines use, and it makes more sense for eval, or at least

Re: Membranes, unmediated access to objects through Object.getPrototypeOf

2012-10-10 Thread Brendan Eich
Tom Van Cutsem wrote: We should also be wary of adding even more Proxy constructors, as we'll otherwise end up with a combinatorial explosion (revocable branded proxies, branded proxies with a symbol whitelist, etc.) But didn't David find a way to avoid Proxy.revocable, namely make

Re: should we rename the Program grammar production?

2012-10-10 Thread John J Barton
+1 Tracuer uses 'Program' and that makes it too easy to forget that the program consists of multiple Program-s jjb On Wed, Oct 10, 2012 at 11:56 AM, Brendan Eich bren...@mozilla.com wrote: Allen Wirfs-Brock wrote: I proposed that we replace Program in this context with Script. This is

Re: Membranes, unmediated access to objects through Object.getPrototypeOf

2012-10-10 Thread Brendan Eich
David Bruant wrote: 2012/10/10 Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org Tom Van Cutsem wrote: We should also be wary of adding even more Proxy constructors, as we'll otherwise end up with a combinatorial explosion (revocable branded proxies,

Re: should we rename the Program grammar production?

2012-10-10 Thread Rick Waldron
On Wednesday, October 10, 2012 at 6:14 PM, John J Barton wrote: +1 Tracuer uses 'Program' and that makes it too easy to forget that the program consists of multiple Program-s jjb On Wed, Oct 10, 2012 at 11:56 AM, Brendan Eich bren...@mozilla.com wrote: Allen Wirfs-Brock wrote:

Re: should we rename the Program grammar production?

2012-10-10 Thread John J Barton
On Oct 10, 2012 4:20 PM, Rick Waldron waldron.r...@gmail.com wrote: On Wednesday, October 10, 2012 at 6:14 PM, John J Barton wrote: +1 Tracuer uses 'Program' and that makes it too easy to forget that the program consists of multiple Program-s jjb On Wed, Oct 10, 2012 at 11:56 AM,

should we rename the Program grammar production?

2012-10-10 Thread Allen Wirfs-Brock
I'm tarting to work on the global scope/program/module level of the specification. One of the pieces of awkward ES specification terminology has been the use of the word Program as the name for a global top-level StatementList. A ES Program is commonly only a single fragment of what most of