Feature-Request: Add Range type data

Dayvson Lima dayvsonlima31 at gmail.com
Fri Jul 15 17:51:03 UTC 2016


this feature request is inspired by the successful Range object behavior in
ruby language

http://ruby-doc.org/core-2.2.0/Range.html

the intention is to have something like interface to work with value ranges


2016-07-15 14:35 GMT-03:00 Steve Fink <sphink at gmail.com>:

> On 07/14/2016 09:33 PM, Dayvson Lima wrote:
>
> Example:
>
> var myRange = new Range(0,4);
>
> myRange == (0..4)   #=> true
>
>
> This (0..4) syntax doesn't exist, afaik. Do you mean myRange ==
> [0,1,2,3,4]? Given that [1,2] != [1,2], I don't think so. I'm assuming you
> meant that as shorthand.
>
>
>
> new Array(myRange)  #=> [0, 1, 2, 3, 4]
>
>
> I'm not sure what this gives you over
>
>   var Range = function*(start, end) { let i = start; while (i <= end)
> yield i++; };
>
>   var myRange = Range(0, 4);
>   new Array(myRange); # [0, 1, 2, 3, 4], but it empties out myRange
>   [...Range(0, 4)]; # [0, 1, 2, 3, 4]
>
> var charRange = new Range('a', ' d');  #=> ('a'..'d')
>
>
> Ugh. This is very latin1-centric. What is 'a'..'d', again? a ä á à b ç c
> d, perhaps? (Yes, charCodeAt(0) offers a possible interpretation, but it's
> somewhat random.) And what is Range('aa', 'bb')? Range('a', 'bb')?
> Range('A', 'a')? Keep away from characters; they aren't numbers drawn from
> any useful 1-dimensional space.
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 

*Dayvson Lima*

Front End Enginner - Safari Studio
Estagiário de Webdesign e Usabilidade no NTI - UFPE
Graduando em Análise e Desenvolvimento de Sistemas - IFPE Recife
Graduando em Gestão da Tecnologia da Informação (Primeiro ano concluído)
Vice campeão Worldskills (Etapa Estadual - PE) categoria Webdesign /
Webmaster
Técnico em Redes de computadores - SENAI Areias
Contato:(81) 8122-0466
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160715/6c9ed7dd/attachment-0001.html>


More information about the es-discuss mailing list