Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Sam Tobin-Hochstadt
On Mon, May 20, 2013 at 10:32 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: All of these are easy to do if this is just a Map (or has Map on its prototype chain), but with a custom [[MapData]] whose behavior is defined by my spec. Would another way to think about this be as a regular

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Tab Atkins Jr.
On Mon, May 20, 2013 at 11:10 PM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: On Mon, May 20, 2013 at 10:32 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: All of these are easy to do if this is just a Map (or has Map on its prototype chain), but with a custom [[MapData]] whose behavior is

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Sam Tobin-Hochstadt
On Mon, May 20, 2013 at 11:17 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Mon, May 20, 2013 at 11:10 PM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: On Mon, May 20, 2013 at 10:32 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: All of these are easy to do if this is just a Map (or has

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Anne van Kesteren
On Tue, May 21, 2013 at 7:24 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: Is it possible for the environment to change the Map during the turn? IOW, is this always true? m.set(x, 1); assert(m.get(x) === 1); If we ignore the toString() and other validation, yes. But note that setting

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Sam Tobin-Hochstadt
On Mon, May 20, 2013 at 11:32 PM, Anne van Kesteren ann...@annevk.nl wrote: On Tue, May 21, 2013 at 7:24 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: Is it possible for the environment to change the Map during the turn? IOW, is this always true? m.set(x, 1); assert(m.get(x) === 1);

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Tab Atkins Jr.
On Mon, May 20, 2013 at 11:24 PM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: Is it possible for the environment to change the Map during the turn? IOW, is this always true? m.set(x, 1); assert(m.get(x) === 1); Your example is not a restatement of your question. Yes, the environment can

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Sam Tobin-Hochstadt
On Mon, May 20, 2013 at 11:58 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Mon, May 20, 2013 at 11:24 PM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: Is it possible for the environment to change the Map during the turn? IOW, is this always true? m.set(x, 1); assert(m.get(x) === 1);

Re: Module naming and declarations

2013-05-21 Thread Brendan Eich
Kevin Smith wrote: Please! There is no magic pixie dust whereby the Internet solves the configuration problem for us. No pixie dust was involved - just vision. If you would like to define exactly what you mean by configuration problem, I would be happy to get specific. Upthread,

Re: B.3.1 The __proto__ pseudo property

2013-05-21 Thread Brendan Eich
Andrea Giammarchi wrote: can I also suggest to analyze, if there's still any doubt left on a method VS a property yet, this piece of code if not highlighted before? I do not understand what you mean here. Behavior in Safari and FirefoxNightly (V8 still by its own here) ``` var obj =

Re: B.3.1 The __proto__ pseudo property

2013-05-21 Thread Tom Van Cutsem
2013/5/20 Andrea Giammarchi andrea.giammar...@gmail.com I believe having a counterpart in the Object, following a natural expectation where for a get you've got a set, is just fine but surely Reflect should have its own reflection power a part. Yeah, given the existence of

Re: A Challenge Problem for Promise Designers (was: Re: Futures)

2013-05-21 Thread Andreas Rossberg
On 20 May 2013 14:15, Tom Van Cutsem tomvc...@gmail.com wrote: 2013/4/26 Andreas Rossberg rossb...@google.com I'm not sure if your description of E is accurate -- I'd find that surprising. It _is_ a perfectly sensible design to have transparent futures that you can just use in place of the

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Anne van Kesteren
On Tue, May 21, 2013 at 8:11 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: Ok, that's what I thought was going on. We can make some other function calls which might mutate the Map, just as with any other Map that we get from someone else. In that case, my response to Anne stands -- why is

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Sam Tobin-Hochstadt
On Tue, May 21, 2013 at 2:52 AM, Anne van Kesteren ann...@annevk.nl wrote: On Tue, May 21, 2013 at 8:11 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: Ok, that's what I thought was going on. We can make some other function calls which might mutate the Map, just as with any other Map that

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Anne van Kesteren
On Tue, May 21, 2013 at 11:01 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: No, you don't need to do anything differently. Conceptually, there are three things you need: 1. When the Map is created, before it's handed to the program, some items are added. 2. Some platform operations also

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Sam Tobin-Hochstadt
On Tue, May 21, 2013 at 3:09 AM, Anne van Kesteren ann...@annevk.nl wrote: On Tue, May 21, 2013 at 11:01 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: No, you don't need to do anything differently. Conceptually, there are three things you need: 1. When the Map is created, before it's

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Brendan Eich
Sam Tobin-Hochstadt wrote: If the plan is to do that, then you should_not_ use Map. That isn't a Map. But that doesn't need to be a proxy, either. It's something with a signature that could be the same as Map's, but with different semantics. I sense people have trouble drawing the line on

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread David Bruant
Le 21/05/2013 04:06, Tab Atkins Jr. a écrit : For the CSS Variables spec I need to define an object with arbitrary string keys, with the initial set determined by the custom properties set in the style rule, and on modification I need to coerce the provided key to a string, and then go mutate

Non-generic traps for non-generic objects (was: Overriding Map/etc with get/set hooks?)

2013-05-21 Thread David Bruant
Hi, David Bruant wrote: Le 21/05/2013 04:06, Tab Atkins Jr. a écrit : (One way to do this today is to subclass Map and provide my own get/set/etc. functions, but I need to override a potentially-open set (anything that doesn't directly lean on my overridden functions), and it doesn't

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Brendan Eich
David Bruant wrote: This description (arbitrary string keys, bidirectional link with style rule) suggests that you want a proxy (canonical values are in the style rule, the proxy is just a façade with a bit of validation/coercion logic). That's the sort of use case they've been introduced

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread David Bruant
Le 21/05/2013 13:19, Brendan Eich a écrit : David Bruant wrote: This description (arbitrary string keys, bidirectional link with style rule) suggests that you want a proxy (canonical values are in the style rule, the proxy is just a façade with a bit of validation/coercion logic). That's the

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Anne van Kesteren
On Tue, May 21, 2013 at 12:19 PM, Brendan Eich bren...@mozilla.com wrote: So Tab: why do you want to abuse Map instead of make a custom class? As we tried to explain before, the believe is that a lot of Map generics will work directly on this Map-like object, similar to how we want Array methods

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Anne van Kesteren
On Tue, May 21, 2013 at 12:19 PM, Brendan Eich bren...@mozilla.com wrote: Of course, coercing key type makes the API not Map. So if the bi-directionality is important, this would be a custom Map-like class. I guess I also do not really get this. Sure JavaScript does not have a type system

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Sam Tobin-Hochstadt
On Tue, May 21, 2013 at 6:52 AM, Anne van Kesteren ann...@annevk.nl wrote: On Tue, May 21, 2013 at 12:19 PM, Brendan Eich bren...@mozilla.com wrote: Of course, coercing key type makes the API not Map. So if the bi-directionality is important, this would be a custom Map-like class. I guess I

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Brendan Eich
Anne van Kesteren wrote: On Tue, May 21, 2013 at 12:19 PM, Brendan Eichbren...@mozilla.com wrote: So Tab: why do you want to abuse Map instead of make a custom class? As we tried to explain before, the believe is that a lot of Map generics will work directly on this Map-like object, similar

Re: B.3.1 The __proto__ pseudo property

2013-05-21 Thread Andrea Giammarchi
On Tue, May 21, 2013 at 12:56 AM, Brendan Eich bren...@mozilla.com wrote: Andrea Giammarchi wrote: can I also suggest to analyze, if there's still any doubt left on a method VS a property yet, this piece of code if not highlighted before? I do not understand what you mean here. I mean

Re: B.3.1 The __proto__ pseudo property

2013-05-21 Thread Andrea Giammarchi
for always work I meant as long as the object is not sealed/frozen as discussed a while ago On Tue, May 21, 2013 at 9:43 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: On Tue, May 21, 2013 at 12:56 AM, Brendan Eich bren...@mozilla.comwrote: Andrea Giammarchi wrote: can I also

Re: B.3.1 The __proto__ pseudo property

2013-05-21 Thread Brandon Benvie
On 5/21/2013 9:43 AM, Andrea Giammarchi wrote: On Tue, May 21, 2013 at 12:56 AM, Brendan Eich bren...@mozilla.com mailto:bren...@mozilla.com wrote: Andrea Giammarchi wrote: can I also suggest to analyze, if there's still any doubt left on a method VS a property yet, this

Re: B.3.1 The __proto__ pseudo property

2013-05-21 Thread Andrea Giammarchi
consider this then, same thing JSON is doing now in FF and Safari ``` var obj = Object.defineProperty({}, '__proto__', { enumerable: true, writable: true, configurable: true, value: [] }); console.log(obj instanceof Array); // false obj.__proto__ = Array.prototype; console.log(obj

Re: Module naming and declarations

2013-05-21 Thread Kevin Smith
No, what you provided was a demonstration where you complained about a registry for one system, and assumed it for the other. This is just bad-faith argumentation. First, I've shown that a package manager is necessary for non-trivial module graphs, and therefore we should not admit claims

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Tab Atkins Jr.
On Tue, May 21, 2013 at 4:19 AM, Brendan Eich bren...@mozilla.com wrote: David Bruant wrote: This description (arbitrary string keys, bidirectional link with style rule) suggests that you want a proxy (canonical values are in the style rule, the proxy is just a façade with a bit of

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Tab Atkins Jr.
On Tue, May 21, 2013 at 7:19 AM, Sam Tobin-Hochstadt sa...@ccs.neu.edu wrote: On Tue, May 21, 2013 at 6:52 AM, Anne van Kesteren ann...@annevk.nl wrote: On Tue, May 21, 2013 at 12:19 PM, Brendan Eich bren...@mozilla.com wrote: Of course, coercing key type makes the API not Map. So if the

Re: Non-generic traps for non-generic objects (was: Overriding Map/etc with get/set hooks?)

2013-05-21 Thread Tab Atkins Jr.
On Tue, May 21, 2013 at 4:07 AM, David Bruant bruan...@gmail.com wrote: David Bruant wrote: Le 21/05/2013 04:06, Tab Atkins Jr. a écrit : (One way to do this today is to subclass Map and provide my own get/set/etc. functions, but I need to override a potentially-open set (anything that

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Ron Buckton
What if the default Map prototype had a configurable but non-writable data property for a @@coerceKey symbol that pointed to a default coercion function. You could subclass Map and provide your own @@coerceKey implementation. Then Map.prototype.set.call() would be forced to run the custom