Cyril Auburtin (2018-07-01T16:13:16.000Z)
cyril.auburtin at gmail.com (2018-07-02T18:13:34.456Z)
Sure, good points 1) *Is it sugar?* Yes 2) *How much sugar?* Very few, example: `(a, b, s=1)=>Array.from({length: (b-a)/s+1}, (_,i)=>a+i*s)` 3) *Frequency of benefit?* Frequent (building arrays, functional loops) 4) *Expected improvement*? There are possible performance benefits to have a range/seq native function, but the main benefit is avoiding extra packages for something frequent 5) *Userland implementable?* it can definitely, in one line. The drawback is having to rely on an external package, to import it. leftpad now implemeted as String.prototype.padStart is an example case 6) *Implementable?* Does it present potentially difficult or intractable implementation challenges? No 7) *Consistent?* Is it consistent with existing syntactic and semantic practices in the languages? Yes 8) *Holistic?* Does it fill in some obvious logical gap in the current language design? Yes, for creating ranges. There are `Array.from({length: n}, (_, i) => doSomethingWwith(i))` or other similar non-obvious code for creating ranges. A new seq or range function would fill the gap between `Array` constructor which is not usable (because it creates sparse arrays) and `Array.from` or `Array.prototype.fill` which aren't practical enough for creating ranges 9) *Understandable?* Does it place an unsustainable new "cognitive burden" on learners and users of the language? No, rather the opposite 10) *Library?* Is is something that would be better provided as part of some kind of future standard library? I don't think so, because it's short, it may be a static `Array` function, or a global 11) *Intrusive?* Does it take over real estate that might be useful for future features no one has thought of yet, the obvious example being using special characters? No, it's a simple drop-in 12) *Readability?* Is it something that results in a distinct improvement in readability or visible semantic correctness of code? Yes, as described, `Array.from({length: n}, (_, i) => .. )` is not readable and practical enough 13) *Prior art?* Has this or a similar feature already been proposed, and if so what was the reaction, and how is your proposal different from that, or from a similar features existing in other languages? - Array.build was proposed at the time ES6 was discussed I think https://gist.github.com/rwaldron/11186883, it's a different approach for creating ranges, but already an improvement over `Array.from({length: n}, (_, i) => .. )` - Array comprehensions were proposed at the time of ES6 as well, and rejected, reasonably in my opinion - languages like python has a `range` builtin, I can also think of the `seq` linux command, I wouldn't be opposed to a new syntax addition like `[1:10]` as well There were maybe proposals for it in the past, but I didn't find any so far, I could try to create one. Some of you seem to want generators for this, I'd prefer not Le dim. 1 juil. 2018 à 08:03, Bob Myers <rtm at gol.com> a écrit :
cyril.auburtin at gmail.com (2018-07-01T16:24:00.516Z)
Sure, good points 1) *Is it sugar?* Yes 2) *How much sugar?* Very few, example: `(a, b, s=1)=>Array.from({length: (b-a)/s+1}, (_,i)=>a+i*s)` 3) *Frequency of benefit?* Frequent (building arrays, functional loops) 4) *Expected improvement*? There are possible performance benefits to have a range/seq native function, but the main benefit is avoiding extra packages for something frequent 5) *Userland implementable?* it can definitely, in one line. The drawback is having to rely on an external package, to import it. leftpad now implemeted as String.prototype.padStart is an example case 6) *Implementable?* Does it present potentially difficult or intractable implementation challenges? No 7) *Consistent?* Is it consistent with existing syntactic and semantic practices in the languages? Yes 8) *Holistic?* Does it fill in some obvious logical gap in the current language design? Yes, `Array.from({length: n}, (_, i) => doSomethingWwith(i))` or other similar non-obvious code for creating ranges. This new seq or range function would fill the gap between `Array` constructor which is not usable (because it creates sparse arrays) and `Array.from` or `Array.prototype.fill` which aren't practical enough for creating ranges 9) *Understandable?* Does it place an unsustainable new "cognitive burden" on learners and users of the language? No, rather the opposite 10) *Library?* Is is something that would be better provided as part of some kind of future standard library? I don't think so, because it's short, it may be a static `Array` function, or a global 11) *Intrusive?* Does it take over real estate that might be useful for future features no one has thought of yet, the obvious example being using special characters? No, it's a simple drop-in 12) *Readability?* Is it something that results in a distinct improvement in readability or visible semantic correctness of code? Yes, as described, `Array.from({length: n}, (_, i) => .. )` is not readable and practical enough 13) *Prior art?* Has this or a similar feature already been proposed, and if so what was the reaction, and how is your proposal different from that, or from a similar features existing in other languages? - Array.build was proposed at the time ES6 was discussed I think https://gist.github.com/rwaldron/11186883, it's a different approach for creating ranges, but already an improvement over `Array.from({length: n}, (_, i) => .. )` - Array comprehensions were proposed at the time of ES6 as well, and rejected, reasonably in my opinion - languages like python has a `range` builtin, I can also think of the `seq` linux command, I wouldn't be opposed to a new syntax addition like `[1:10]` as well There were maybe proposals for it in the past, but I didn't find any so far, I could try to create one. Some of you seem to want generators for this, I'd prefer not Le dim. 1 juil. 2018 à 08:03, Bob Myers <rtm at gol.com> a écrit :
cyril.auburtin at gmail.com (2018-07-01T16:21:55.991Z)
Sure, good points 1) *Is it sugar?* Yes 2) *How much sugar?* Very few, example: `(a, b, s=1)=>Array.from({length: (b-a)/s+1}, (_,i)=>a+i*s)` 3) *Frequency of benefit?* Frequent (building arrays, functional loops) 4) *Expected improvement*? There are possible performance benefits to have a range/seq native function, but the main benefit is avoiding extra packages for something frequent 5) *Userland implementable?* it can definitely, in one line. The drawback is having to rely on an external package, to import it. leftpad now implemeted as String.prototype.padStart is an example case 6) *Implementable?* Does it present potentially difficult or intractable implementation challenges? No 7) *Consistent?* Is it consistent with existing syntactic and semantic practices in the languages? Yes 8) *Holistic?* Does it fill in some obvious logical gap in the current language design? Yes, `Array.from({length: n}, (_, i) => doSomethingWwith(i))` or other similar non-obvious code for creating ranges. This new seq or range function would fill the gap between `Array` constructor which is not usable (because it creates sparse arrays) and `Array.from` or `Array.prototype.fill` which aren't practical enough for creating ranges 9) *Understandable?* Does it place an unsustainable new "cognitive burden" on learners and users of the language? No, rather the opposite 10) *Library?* Is is something that would be better provided as part of some kind of future standard library? I don't think so, because it's short, it may be a static `Array` function, or a global 11) *Intrusive?* Does it take over real estate that might be useful for future features no one has thought of yet, the obvious example being using special characters? No, it's a simple drop-in 12) *Readability?* Is it something that results in a distinct improvement in readability or visible semantic correctness of code? Yes, as described, `Array.from({length: n}, (_, i) => .. )` is not readable and practical enough 13) *Prior art?* Has this or a similar feature already been proposed, and if so what was the reaction, and how is your proposal different from that, or from a similar features existing in other languages? - Array.build was proposed at the time ES6 was discussed I think https://gist.github.com/rwaldron/11186883, it's a different approach for creating ranges, but already an improvement over `Array.from({length: n}, (_, i) => .. )` - Array comprehensions were proposed at the time of ES6 as well, and rejected, reasonably in my opinion - languages like python has a `range` builtin, I can also think of the `seq` linux command, I wouldn't be opposed to a new syntax addition like `[1:10]` as well There were maybe proposals for it in the past, but I didn't find any so far, I could try to create one. Some of you seems to want generators for this, I'd prefer not Le dim. 1 juil. 2018 à 08:03, Bob Myers <rtm at gol.com> a écrit :
cyril.auburtin at gmail.com (2018-07-01T16:21:41.774Z)
Sure, good points 1) *Is it sugar?* Yes 2) *How much sugar?* Very few, example: `(a, b, s=1)=>Array.from({length: (b-a)/s+1}, (_,i)=>a+i*s)` 3) *Frequency of benefit?* Frequent (building arrays, functional loops) 4) *Expected improvement*? There are possible performance benefits to have a range/seq native function, but the main benefit is avoiding extra packages for something frequent 5) *Userland implementable?* it can definitely, in one line. The drawback is having to rely on an external package, to import it. leftpad now implemeted as String.prototype.padStart is an example case 6) *Implementable?* Does it present potentially difficult or intractable implementation challenges? No 7) *Consistent?* Is it consistent with existing syntactic and semantic practices in the languages? Yes 8) *Holistic?* Does it fill in some obvious logical gap in the current language design? Yes, `Array.from({length: n}, (_, i) => doSomethingWwith(i))` or other similar non-obvious code for creating ranges. This new seq or range function would fill the gap between `Array` constructor which is not usable (because it creates sparse arrays) and `Array.from` or `Array.prototype.fill` which aren't practical enough for creating ranges 9) *Understandable?* Does it place an unsustainable new "cognitive burden" on learners and users of the language? No, rather the opposite 10) *Library?* Is is something that would be better provided as part of some kind of future standard library? I don't think so, because it's short, it may be a static `Array` function, or a global 11) *Intrusive?* Does it take over real estate that might be useful for future features no one has thought of yet, the obvious example being using special characters? No, it's a simple drop-in 12) *Readability?* Is it something that results in a distinct improvement in readability or visible semantic correctness of code? Yes, as described, `Array.from({length: n}, (_, i) => .. )` is not readable and practical enough 13) *Prior art?* Has this or a similar feature already been proposed, and if so what was the reaction, and how is your proposal different from that, or from a similar features existing in other languages? - Array.build was proposed at the time ES6 was discussed I think https://gist.github.com/rwaldron/11186883, it's a different approach for creating ranges, but already an improvement over `Array.from({length: n}, (_, i) => .. )` - Array comprehensions were proposed at the time of ES6 as well, and rejected, reasonably in my opinion - languages like python has a `range` builtin, I can also think of the `seq` linux command, I wouldn't be opposed to a new syntax addition like `[1:10]` as well There were maybe proposals for it in the past, but I didn't find any so far, I could try to create one. Some of you seems to want generators for this, I'd prefer not Le dim. 1 juil. 2018 à 08:03, Bob Myers <rtm at gol.com> a écrit :