Re: Array.prototype.includesAll

2016-06-14 Thread Renki Ivanko
There are no items in [] that aren't included in [2,3]. A separate question is whether undefined should mean []; I'd say it should throw a TypeError instead. On Tue, Jun 14, 2016 at 10:06 PM, Shahar Or wrote: > What's the point of using `reduce` instead of `every`?

Re: Process of proposing targeted deconstruction

2016-06-01 Thread Renki Ivanko
It's wishful thinking to say that ES7 isn't in common use; there's not much reason for it to be less common than ES6. ES2016 still has the same problems as ES2015: 6 characters means it barely counts as an abbreviation; bigger numbers are not good for humans; the last digit being off by one from

Re: Ignoring arguments

2016-05-29 Thread Renki Ivanko
*[,,i]* > > It's possible with *(...[,i]) => {}, (_,i)=>{} *like Renki said, but > slightly less simply > > Are there possible issues with that 'extension' of function syntax? > > > 2016-05-29 21:32 GMT+02:00 Renki Ivanko <fatalis.erra...@gmail.com>: > >&g

Re: Ignoring arguments

2016-05-29 Thread Renki Ivanko
You could stop with "rare"; having to make up unused names is an obvious smell in comparison. ```js foo(UNUSED1, UNUSED2, x) foo(_, __, x) foo(,, x) foo(...[,, x]) ``` The latter is shorter and more explicit and would not be any more confusing if it became common. On Sun, May 29, 2016 at

Re: Ignoring arguments

2016-05-29 Thread Renki Ivanko
It works in V8 at least, so I assumed it's correct. On Sun, May 29, 2016 at 8:29 PM, Bob Myers <r...@gol.com> wrote: > I'm quite sure this syntax is invalid. > > > On Sun, May 29, 2016 at 9:36 PM, Renki Ivanko <fatalis.erra...@gmail.com> > wrote: > >> You can

Re: Ignoring arguments

2016-05-29 Thread Renki Ivanko
You can already do it like this: ```js ((...[,,foo]) => foo)(1, 2, 3) // -> 3 ``` R. On Sun, May 29, 2016 at 6:53 PM, Cyril Auburtin wrote: > Similarly to: > > `var [,x,,y] = [1,2,3,4,5,6];` > > I think it could be interesting to let a field empty

Re: A plan to help TC39 become more open up to community contributions and participations

2016-05-28 Thread Renki Ivanko
This organization is definitely needed and is a laudable effort; the language has made great strides, but it's still in a state where utility libraries fill in gaps in basic functionality, and the current rate of improvement is very uneven, with certain issues that hold the language from becoming

Map.prototype.of()

2016-05-28 Thread Renki Ivanko
Maps are the preferred data structure to POJOs in modern JS, but initializing them is comparatively cumbersome: ```js new Map(Object.entries({a: 1, b: 2, 3: 4})) new Map([['a', 1], ['b', 2], [3, 4]]) new Map().set('a', 1).set('b', 2).set(3, 4) ``` The `Object.entries()` syntax only works for

Re: Reflect.create()

2016-05-26 Thread Renki Ivanko
Everything about this is confusing; you should slow down and think things through more. R. On Fri, May 27, 2016 at 1:25 AM, even stensberg wrote: > That's one of the reasons why GitHub is a better place to discuss this ;) > > As I tried to say, this is work in

Re: Is it possible to define an array iterator that adjusts to your for-of syntax?

2016-05-23 Thread Renki Ivanko
There could be a protocol for defining the shape of the iterator's returns, but it would need to use functions instead of the loop syntax. I've previously suggested something like: ```js iterator[Symbol.shape] = Symbol.shape.entries ``` Then a generic iteration function supporting this interface

Re: extending an ES6 class using ES5 syntax?

2016-05-13 Thread Renki Ivanko
> > That said, can't the right thing be done using Reflect.construct? > It can: ```js function B() { return Reflect.construct(A, arguments) } ``` `instanceof B` will be `false`, though. ___ es-discuss mailing list es-discuss@mozilla.org

Re: extending an ES6 class using ES5 syntax?

2016-05-13 Thread Renki Ivanko
This may be a small bit nicer: ```js class A {} function B() { return Reflect.construct(A, arguments, B) } Reflect.setPrototypeOf(B.prototype, A.prototype) Reflect.setPrototypeOf(B, A) ``` ___ es-discuss mailing list es-discuss@mozilla.org

Re: Tracking proposals should be standardized with issues

2016-05-12 Thread Renki Ivanko
Turned out there's a recently created file for documenting past proposals; linking for completeness: https://github.com/tc39/ecma262/blob/master/withdrawn-proposals.md ___ es-discuss mailing list es-discuss@mozilla.org

Re: "Super" hoisting

2016-05-12 Thread Renki Ivanko
Formatted the code so that it can be read: ``` class thing { constructor {} doSomething(x, y) { let a = x + y; let b = ay; let c = bx; return (c); } } class thing { constructor { let _doSomething_a = null; let _doSomething_b = null;

Tracking proposals should be standardized with issues

2016-05-11 Thread Renki Ivanko
The issue tracker should have a labeled issue matching every proposal, so that it's possible to look through previous proposals and track their status, instead of just manually compiled lists of current proposals. Older proposals can essentially only be found by stumbling upon them, and their

Re: Generic iteration method idea with example implementation and tests

2016-05-08 Thread Renki Ivanko
To clarify, the few currently implemented methods are just to demonstrate the idea; the full implementation should have the other methods like `every()` to allow breaking the iteration and `forEach()` for side-effects. Regarding the mention of lazy iteration, the point is that `Array.from()`,

Re: Generic iteration method idea with example implementation and tests

2016-05-08 Thread Renki Ivanko
The methods could be added to the `Object` constructor and used like so: ``` const {map, filter, reduce} = Object ``` ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Generic iteration method idea with example implementation and tests

2016-05-08 Thread Renki Ivanko
ES5 added the Array iteration methods for iterating over, transforming and reducing arrays, which arguably offer benefits in readability and description of intent, but there are certain pitfalls with applying the methods to the other collection types, which have increased in ES6 with the addition

Re: Re: Adding a non-class-syntax method for subclassing native objects

2016-05-05 Thread Renki Ivanko
It would be helpful to have the MakeConstructor operation implemented as `Reflect.makeConstructor(F, writablePrototype, prototype)`, since otherwise the alternative to the `class extends` syntax is very verbose. It would also be consistent with the `Reflect.construct()` method corresponding to the

Re: Re: Adding a non-class-syntax method for subclassing native objects

2016-05-05 Thread Renki Ivanko
Thanks, I had missed the `Reflect.construct()` method. One problem with your solution is that the `Array` iterator methods like `.map()` use `this.constructor[Symbol.species]` to construct their result, so the prototype actually needs to be set like this: ``` SubArray.prototype =

Adding a non-class-syntax method for subclassing native objects

2016-05-03 Thread Renki Ivanko
It's currently impossible to inherit the behavior of exotic builtin objects like `Array` without using the `class extends` syntax, which is surprising to someone who has only seen the `class` syntax described as syntactical sugar for prototypal inheritance, since it means that the `class extends`