Proposal: Support for Proper Modular Arithmetic

2017-08-02 Thread Lachlan Hunt
Hi, I have researched and drafted a proposal to address the deficiencies with the remainder operator (%) and introduce support for the proper mathematical modulo operation. https://github.com/lachlanhunt/es-proposals/tree/master/modulo In summary, the % operator is commonly used and referre

Re: Re: An update on rest operator ?

2017-08-02 Thread James Browning
I still think it's silly that `[...rest, last]` isn't allowed, the point that it's "iterable destructuring" is actually irrelevant as if there's a spread it's always coerced to an array e.g.: ``` function* nums() { yield 1 yield 2 yield 3 yield 4 } const [first, ...rest] = nums()

Re: Stream + async await

2017-08-02 Thread Jan-Ivar Bruaroey
Right, the proposals went beyond that. In this context though I thought T.J. was looking for a control surface in promises. I shouldn't assume. In any case, the original challenge here seems solved by something like: ```javascript var wait = ms => new Promise(resolve => setTimeout(resolve, ms)

Re: an operator for ignoring any exceptions

2017-08-02 Thread Tab Atkins Jr.
On Wed, Aug 2, 2017 at 3:45 AM, T.J. Crowder wrote: > On Wed, Aug 2, 2017 at 4:58 AM, Sheng TIAN wrote: >> Is there any proposal for an one unary operator for ignoring any >> exceptions. >> >> (I have not search out any related threads. But it is useful IMO, >> so I'm wondering if this had been d

Re: An update on rest operator ?

2017-08-02 Thread Siegfried Ehret
Thanks a lot. I was not sure if this this would be related to rest operator of to destructuring...And I wasn't well aware of «The reason this doesn't work is because ... in this context is not array destructuring - it's *iterable* destructuring.» I would love to read a reply to the last message (

Re: An update on rest operator ?

2017-08-02 Thread T.J. Crowder
Previous disussions: https://esdiscuss.org/topic/strawman-complete-array-and-object-destructuring https://esdiscuss.org/topic/rest-parameters -- T.J. Crowder On Wed, Aug 2, 2017 at 10:58 AM, Siegfried Ehret wrote: > Hello, > > This is a small idea I had recently: to update the rest operator t

Re: an operator for ignoring any exceptions

2017-08-02 Thread T.J. Crowder
On Wed, Aug 2, 2017 at 4:58 AM, Sheng TIAN wrote: > Is there any proposal for an one unary operator for ignoring any > exceptions. > > (I have not search out any related threads. But it is useful IMO, > so I'm wondering if this had been discussed.) In general, a thorough search before posting is

An update on rest operator ?

2017-08-02 Thread Siegfried Ehret
Hello, This is a small idea I had recently: to update the rest operator to make it work not only to get the last elements. As an example, we already have: ```javascript const myArray = [1, 2, 3, 4, 5, ..., 99, 100]; [first, second, ...rest] = myArray; // first = 1 // second = 2 // rest = [3, 4,

Re: an operator for ignoring any exceptions

2017-08-02 Thread Siegfried Ehret
Hello, This proposal approach the same subject: https://github.com/michaelficarra/optional-catch-binding-proposal/ (stage 3) Not handling errors is a bad practice. I join Kai Zhu and Frederick Stark here, this should not be a language feature. -- Siegfried Ehret siegfr...@ehret.me On Wed, A