Andrei Alexandrescu, el 23 de octubre a las 11:09 me escribiste: > Bill Baxter wrote: > >On Fri, Oct 23, 2009 at 5:13 AM, Andrei Alexandrescu > ><seewebsiteforem...@erdani.org> wrote: > >>Yigal Chripun wrote: > >>>On 23/10/2009 13:02, bearophile wrote: > >>>>Chris Nicholson-Sauls: > >>>> > >>>>>I prefer this (Scala): > >>>>>list = list ++ (0 to 10) > >>>>That's quite less readable. Scala sometimes has some unreadable syntax. > >>>>Python has taught me how much useful a readable syntax is :-) > >>>>Designing languages requires to find a balance between several different > >>>>and opposed needs. > >>>> > >>>>Bye, > >>>>bearophile > >>>how about this hypothetical syntax: > >>> > >>>list ~= [0..10]; > >>I'm not sure what the type of "list" is supposed to be, but this works today > >>for arrays: > >> > >>list ~= array(iota(0, 10)); > > > >While we're not on the subject.... > >"Iota" is right up there with "inSitu". > >I know it has a precedent elsewhere, but it sounds about as user > >friendly as monads. It just sounds like the language it trying to be > >snooty. Like "if you don't even know what iota is, you're clearly not > >qualified to join our little D club. Maybe you should try Java... or > >Logo". Compare that to Python where it's called "range", something > >every Joe the Programmer can certainly grok without having to get a > >Greek to English dictionary. > > Given that "range" is already taken, what name do you think would work best? > > (I sometimes deliberately prefer less-used names because the more > used ones often come with baggage and ambiguities (as is the case > with "range"). Case in point, "in-situ" is more informative than > "in-place" because the former suggests emplacement of a substructure > within a larger structure. So to me an "in-situ" class member inside > a class has a clear meaning that the member sits right there within > the class. But anyhow I will use in-place from now on.)
I don't see "range" taken inside the range module. I think it even makes sense, iota() is the more primitive range ever, so why don't just call it range()? :) Anyway, I think it makes perfect sense to have the compiler translating x..y to a iota/range(x, y). -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- CAROZO CON FARINGITIS -- Crónica TV