Re: Template site objects and WeakMap

2015-06-17 Thread Mark S. Miller
On Wed, Jun 17, 2015 at 11:19 AM, Yusuke SUZUKI utatane@gmail.com wrote: It turns out the spec is fine https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.set step 5 says If Type

Re: Template site objects and WeakMap

2015-06-17 Thread Boris Zbarsky
On 6/17/15 2:35 PM, Mark S. Miller wrote: What do other browsers currently do? Firefox: var w = new WeakMap(); var r = Symbol.for('foo'); w.set(r, true); TypeError: r is not a non-null object WebKit nightly: var w = new WeakMap(); var r = Symbol.for('foo'); w.set(r, true); TypeError:

Re: Named `this` and `this` destructuring

2015-06-17 Thread Jussi Kalliokoski
On Wed, Jun 17, 2015 at 10:35 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: OK **that one** I've no idea what supposes to improve exactly ... I should have tried to realize your proposal better, apologies. After seeing that, I probably agree with Allen at this point we don't

Re: Re: Template site objects and WeakMap

2015-06-17 Thread Andrea Giammarchi
actually I was surprised the apparently mentioned native behavior looked too much like my Symbol based WeakMap partial poly: ```js var WeakMap = WeakMap || (function (s) {'use strict'; function WeakMap() { this[s] = Symbol('WeakMap'); } WeakMap.prototype = { 'delete': function

Re: Template site objects and WeakMap

2015-06-17 Thread Yusuke SUZUKI
It turns out the spec is fine https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.set step 5 says If Type https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values (*key*) is not Object, throw a *TypeError* exception. as I hoped

Re: Template site objects and WeakMap

2015-06-17 Thread Mark S. Miller
TypeError: Invalid value used as weak map key Yes, already fixed on v8. Thanks. On Wed, Jun 17, 2015 at 11:51 AM, Caitlin Potter caitpotte...@gmail.com wrote: The v8 bug referred to earlier in this thread was filed by Rick Waldron and fixed back in March, I think engines are on the same

Re: Template site objects and WeakMap

2015-06-17 Thread Benjamin Gruenbaum
It would return a different object each time (for the same Symbol, like new String) so it would not exhibit the problem of being observable. On Jun 17, 2015, at 20:54, Jordan Harband ljh...@gmail.com wrote: Could I not use `Object(Symbol.for('some global registry symbol'))` as a `WeakMap`

Re: Template site objects and WeakMap

2015-06-17 Thread Mark S. Miller
On Wed, Jun 17, 2015 at 9:31 AM, Yusuke SUZUKI utatane@gmail.com wrote: On Thu, Jun 18, 2015 at 1:18 AM, Mark S. Miller erig...@google.com wrote: [+Allen] Can registered Symbols be used as keys in WeakMaps? If so, we have a fatal unauthorized communications channel that we need to fix

Re: Template site objects and WeakMap

2015-06-17 Thread Caitlin Potter
The v8 bug referred to earlier in this thread was filed by Rick Waldron and fixed back in March, I think engines are on the same page with this — just FYI On Jun 17, 2015, at 2:49 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 6/17/15 2:35 PM, Mark S. Miller wrote: What do other browsers

Re: Named `this` and `this` destructuring

2015-06-17 Thread Andrea Giammarchi
OK **that one** I've no idea what supposes to improve exactly ... I should have tried to realize your proposal better, apologies. After seeing that, I probably agree with Allen at this point we don't really need that kind of syntax around JS (still IMHO, of course) Best Regards On Wed, Jun 17,

Re: Template site objects and WeakMap

2015-06-17 Thread Andrea Giammarchi
uh ... never mind then, I don't even need to understand :D Cheers On Wed, Jun 17, 2015 at 7:51 PM, Caitlin Potter caitpotte...@gmail.com wrote: The v8 bug referred to earlier in this thread was filed by Rick Waldron and fixed back in March, I think engines are on the same page with this —

Re: Re: Template site objects and WeakMap

2015-06-17 Thread Jordan Harband
Could I not use `Object(Symbol.for('some global registry symbol'))` as a `WeakMap` key? That would return a realm-specific object, of course. On Wed, Jun 17, 2015 at 10:19 AM, Benjamin Gruenbaum ing...@gmail.com wrote: congratulations and THANK YOU! I learned something important reading your

Re: Re: Template site objects and WeakMap

2015-06-17 Thread Benjamin Gruenbaum
Interning of a particular immutable-objects-with-identity in an interning table can still safely be weakly interned, by marking that object, at interning time, so all WeakMaps from then on hold it strongly Oh cool, I didn't realize that. That is pretty neat :) On Wed, Jun 17, 2015 at 10:54 PM,

Re: Template site objects and WeakMap

2015-06-17 Thread Boris Zbarsky
On 6/17/15 1:54 PM, Jordan Harband wrote: Could I not use `Object(Symbol.for('some global registry symbol'))` as a `WeakMap` key? That would return a realm-specific object, of course. Object(Symbol.for(x)) == Object(Symbol.for(x)) tests false. That's because

Re: Re: Template site objects and WeakMap

2015-06-17 Thread Mark S. Miller
The idea that (a shared Weak interning table of immutable-objects-with-identity + WeakMaps makes gc observable) is not new. The idea that (the shared interning tables of immutable-objects-with-identity must therefore be strong) is not new. What was new to me is the idea that Interning of a

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread Michael Dyck
On 15-06-17 12:46 PM, Allen Wirfs-Brock wrote: Ecma international has announced that its General Assembly has approved ECMA-262-6 /The ECMAScript 2015 Language Specification/ as an Ecma standard http://www.ecma-international.org/news/index.html Congrats! The official document is now

Re: Template site objects and WeakMap

2015-06-17 Thread Andrea Giammarchi
this is puzzling me too ... so I've got few cases 1. you want/need a one to many relations, Symbol as key, Array as value, and you play with that Array values as needed per each Symbol used as key in the very same WeakMap 2. you invert the logic and you have a WeakMap that checks per each

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread Dmitry Soshnikov
Congrats the whole TC-39, and special thanks to Allen Wirfs-Brock for the actual great editorial work on the spec! Dmitry On Wed, Jun 17, 2015 at 9:46 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Ecma international has announced that its General Assembly has approved ECMA-262-6 *The

Re: Named `this` and `this` destructuring

2015-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2015, at 10:01 AM, Jussi Kalliokoski wrote: ... More examples of the power of the bind syntax can be found in the links, but the bind syntax combined with my proposal would for example allow this: ```JS function add (a, b) { return a + b; } 2::add(3) // 5 ``` and why

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2015, at 2:34 PM, Michael Dyck wrote: On 15-06-17 12:46 PM, Allen Wirfs-Brock wrote: Ecma international has announced that its General Assembly has approved ECMA-262-6 /The ECMAScript 2015 Language Specification/ as an Ecma standard

Re: Named `this` and `this` destructuring

2015-06-17 Thread Andrea Giammarchi
the ::bind syntax is OK (I don't really like that double colon 'cause it's not semantic at all with the single colon meaning but I can live with it) but having potential bitwise-like operators around to adress a possible context ... well, I wouldn't probably use/need that in the short, or even

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread Axel Rauschmayer
The official document is now available from Ecma in HTML at http://www.ecma-international.org/ecma-262/6.0 http://www.ecma-international.org/ecma-262/6.0 and as a PDF at http://www.ecma-international.org/ecma-262/6.0/ECMA-262.pdf

Re: Template site objects and WeakMap

2015-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2015, at 9:18 AM, Mark S. Miller wrote: [+Allen] Can registered Symbols be used as keys in WeakMaps? If so, we have a fatal unauthorized communications channel that we need to fix in the spec asap! No, symbols are not objects and the keys of WeakMaps must be objects. BTW,

Re: Named `this` and `this` destructuring

2015-06-17 Thread Jussi Kalliokoski
On Wed, Jun 17, 2015 at 10:45 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: the ::bind syntax is OK (I don't really like that double colon 'cause it's not semantic at all with the single colon meaning but I can live with it) but having potential bitwise-like operators around to

revive let blocks

2015-06-17 Thread Kyle Simpson
I'd like to ask if there's anyone on TC39 that would be willing to champion a proposal to add the let-block (let-statement) syntax? I currently write my block-scoped declarations as: ```js { let a = 2, b, c; // .. } ``` I do this because I want to be in the habit of always putting my

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread C. Scott Ananian
Filed Pull Requests to es6-shim and core-js to match the late change to the `Promise.reject` text. Yay final spec! --scott ​ ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Re: Template site objects and WeakMap

2015-06-17 Thread Benjamin Gruenbaum
congratulations and THANK YOU! I learned something important reading your messages. The notion that we can preserve non-observability when making one thing a WeakMap iff we make all other WeakMaps be strong for those same objects is true, novel, and very surprising. I have been working on

Re: Template site objects and WeakMap

2015-06-17 Thread Mark S. Miller
I am curious about what these are? But regardless, I would expect there to be examples where it would be useful if it weren't fatal. Regarding the issues in this thread, it actually would be safe to allow unregistered Symbols as keys. But unless these examples are tremendously compelling, please

Re: Re: Named `this` and `this` destructuring

2015-06-17 Thread Jason Kuhrt
Exactly what Allen said. Adding syntax to work around a bad feature is an awful idea. We should be trying to reduce and remove usage of `this` by reducing resistance to other ways of programming in JavaScript. Minimal API Surface areas apply to languages, not just libraries.

Named `this` and `this` destructuring

2015-06-17 Thread Jussi Kalliokoski
It's probably a bit early for this, but I figured I'd put it out there (I already proposed this as a tangent in the function bind syntax thread). This syntax proposal is purely about convenience and subjective expressiveness (like any feature addition to a Turing complete language). As I've been

Re: Template site objects and WeakMap

2015-06-17 Thread Mark Miller
Hi Yusuke, congratulations and THANK YOU! I learned something important reading your messages. The notion that we can preserve non-observability when making one thing a WeakMap iff we make all other WeakMaps be strong for those same objects is true, novel, and very surprising. I have been working

Re: Named `this` and `this` destructuring

2015-06-17 Thread Andrea Giammarchi
Mostly every Array extra in ES5 would work with those functions, e.g. ```js function multiplyPoints (_p2) { var { x1: x, y1: y } = this; var { x2: x, y2: y } = _p2; return { x: x1 * x2, y: y1 * y2 }; } var multiplied = manyPoints.map(multiplyPoints, centralPoint); ``` It's not that common

Re: Named `this` and `this` destructuring

2015-06-17 Thread C. Scott Ananian
Could you include some examples of *calling* functions defined this way? The most obvious way uses `Function#call` and would be terribly awkward. Perhaps I'm just overlooking some ES6 feature which makes passing a specific `this` value easy? It seems curious that you are not using methods instead

ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread Allen Wirfs-Brock
Ecma international has announced that its General Assembly has approved ECMA-262-6 The ECMAScript 2015 Language Specification as an Ecma standard http://www.ecma-international.org/news/index.html The official document is now available from Ecma in HTML at

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread Andrea Giammarchi
congratulations and I recommend that people immediately start using the Ecma HTML version in discussion where they need to link references to sections of the specification. good advice ! Best Regards On Wed, Jun 17, 2015 at 5:46 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Ecma

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread Benjamin Gruenbaum
This is awesome news - now to get someone to make something similar to es5.github.io in terms of readability and ease of use :) On Jun 17, 2015, at 19:46, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Ecma international has announced that its General Assembly has approved ECMA-262-6 The

Re: Template site objects and WeakMap

2015-06-17 Thread Benjamin Gruenbaum
Aren't WeakMap keys only objects? On Jun 17, 2015, at 19:18, Mark S. Miller erig...@google.com wrote: [+Allen] Can registered Symbols be used as keys in WeakMaps? If so, we have a fatal unauthorized communications channel that we need to fix in the spec asap!

Re: ECMAScript 2015 is now an Ecma Standard

2015-06-17 Thread David Bruant
Lots of the changes were long awaited. ES2015 is an important milestone. More important even is the momentum and recent changes to the way people can contribute to the standard. Thank you to everyone involved in making all of this happen! David Le 17/06/2015 17:46, Allen Wirfs-Brock a écrit

Re: Named `this` and `this` destructuring

2015-06-17 Thread Andrea Giammarchi
I forgot to mention that those functions I use as both methods and map/filters are most of the time **private** , and yet we haven't introduced private methods within current class specification. Functions with a `this` are very portable/handy within closures, combined with Array extras and

Re: Template site objects and WeakMap

2015-06-17 Thread Yusuke SUZUKI
On Thu, Jun 18, 2015 at 1:18 AM, Mark S. Miller erig...@google.com wrote: [+Allen] Can registered Symbols be used as keys in WeakMaps? If so, we have a fatal unauthorized communications channel that we need to fix in the spec asap! Why do registered Symbols appear? (oops, maybe I missed

Re: Named `this` and `this` destructuring

2015-06-17 Thread Allen Wirfs-Brock
On Jun 17, 2015, at 8:09 AM, Andrea Giammarchi wrote: Mostly every Array extra in ES5 would work with those functions, e.g. ```js function multiplyPoints (_p2) { var { x1: x, y1: y } = this; var { x2: x, y2: y } = _p2; return { x: x1 * x2, y: y1 * y2 }; } var multiplied =

Re: Template site objects and WeakMap

2015-06-17 Thread Yusuke SUZUKI
On Wed, Jun 17, 2015 at 10:41 PM, Mark Miller erig...@gmail.com wrote: Hi Yusuke, congratulations and THANK YOU! I learned something important reading your messages. The notion that we can preserve non-observability when making one thing a WeakMap iff we make all other WeakMaps be strong for

Re: Template site objects and WeakMap

2015-06-17 Thread Mark S. Miller
[+Allen] Can registered Symbols be used as keys in WeakMaps? If so, we have a fatal unauthorized communications channel that we need to fix in the spec asap! ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss