Feature-Request: Add Range type data

2016-07-14 Thread Dayvson Lima
Example: var myRange = new Range(0,4); myRange == (0..4) #=> true new Array(myRange) #=> [0, 1, 2, 3, 4] var charRange = new Range('a', ' d'); #=> ('a'..'d') new Array(myRange) #=> ['a', 'b', 'c', 'd'] ___ es-discuss mailing list

Re: Redefining a let variable inside a for loop scope doesn't work?

2016-07-14 Thread Logan Smyth
I think you may be misunderstanding that error. `for (let n of foo){ }` does create an `n` value inside the loop. The issue isn't that `n` doesn't exist inside the loop, it's that `n` has already been shadowed by the time `n.a` is evaluated, meaning you're accessing `.a` of an uninitialized

Re: Feature-Request: allow to iterate over WeakSet / WeakMap

2016-07-14 Thread Isiah Meadows
You could also solve the iterability this way with weak references: ```js function *iter(wm) { for (const ref of wm._refs) { const key = ref.get() yield [key, wm.get(key)] } } function remove({wm, ref}) { wm._refs.remove(ref) } class IterableWeakMap extends WeakMap {

Re: Redefining a let variable inside a for loop scope doesn't work?

2016-07-14 Thread Blake Regalia
`let n of n.a` is inside the `function` scope, not the `for` scope (look at the brackets). This is invalid/terrible-practice because `n` is already defined, and you are trying to use `let` to declare a new variable even though it already exists in the same scope. - Blake On Thu, Jul 14, 2016

Redefining a let variable inside a for loop scope doesn't work?

2016-07-14 Thread /#!/JoePea
The following examples are very confusing, and throw an error that `n` is undefined: ```js function go(n){ for (let n of n.a) { console.log(n); } } go({a:[1,2,3]}); ``` ```js let n = {a:[1,2,3]} for (let n of n.a) { console.log(n); } ``` Why does the `let n` in the for loop not

Re: ModuleDeclarationInstantiation behaviour after failure

2016-07-14 Thread Allen Wirfs-Brock
> On Jul 14, 2016, at 3:51 AM, Jon Coppeard > wrote: > > On 07/07/2016 22:33, Allen Wirfs-Brock wrote: >> I would expect implementations to >> discard any module records it created during a linking phase that throws >> errors. > > I think

Re: Feature-Request: allow to iterate over WeakSet / WeakMap

2016-07-14 Thread MichaƂ Wadas
What you think you need: iterable WeakMap What you really need: WeakReference, PhantomReference. Personally I think we need built-in class "GarbageCollectorObserver" that emit events for each observed collected object (uniquely identified by strongly-held symbols), it will solve most of problems

Re: ModuleDeclarationInstantiation behaviour after failure

2016-07-14 Thread Jon Coppeard
On 07/07/2016 22:33, Allen Wirfs-Brock wrote: > I would expect implementations to > discard any module records it created during a linking phase that throws > errors. I think it's not trivial to know which module records to discard. Thinking out loud: A module loader may be simultaneously

Re: Class expressions in object initializers.

2016-07-14 Thread Blake Regalia
A reference to a class is simply a variable. Variables only exist within a certain scope. When using a variable, its name is essentially irrelevant so long as you, the developer, understand what it refers to. If its necessary to distinguish between multiple instances of an object that were

Re: Class expressions in object initializers.

2016-07-14 Thread Bergi
/#!/JoePea schrieb: A use case could be to dynamically name a class at runtime without `eval`. `let o = { [name]() {} }` produces a named function inside of `o` (at least in Chrome) without needing eval, and then we can extract it from the object. If you just want to name a class, there are

Re: Class expressions in object initializers.

2016-07-14 Thread /#!/JoePea
A use case could be to dynamically name a class at runtime without `eval`. `let o = { [name]() {} }` produces a named function inside of `o` (at least in Chrome) without needing eval, and then we can extract it from the object. */#!/*JoePea On Wed, Jul 13, 2016 at 7:48 PM, Blake Regalia