Ranges

Andy Earnshaw andyearnshaw at gmail.com
Sun Dec 11 18:41:37 UTC 2016


On Thu, 3 Nov 2016 at 22:11 Zach Lym <zachlym at indolering.com> wrote:

> With regard to syntax, Rust's is the best that I've seen: '0 ... 10'
> inclusive and  '1 .. 9' exclusive.
>

I love Rust's syntax too, but unfortunately 1..<something> is already valid
ES syntax:

    1..Infinity
    //-> undefined

    Number.prototype.foo = 'bar'
    1..foo
    //-> 'bar'

You'd have to enforce the spaces around the operator, which would be weird
IMO.  `...` would be ok though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161211/3fd4b8f5/attachment.html>


More information about the es-discuss mailing list