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 <[email protected]>: > 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 > [email protected] > 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
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

