Andrei Alexandrescu, el 19 de octubre a las 12:40 me escribiste: > Leandro Lucarella wrote: > >Andrei Alexandrescu, el 19 de octubre a las 11:16 me escribiste: > >>>>>I'm missing something? Why this shouldn't work? > >>>>It may work, but I was unable to pull it off reasonably well. > >>>What problems did you find? > >>I thought I explained that above and in several other posts. I have > >>the feeling this is going in circles, but let me add one more thing. > >>People would want to have a reasonable way of choosing between > >>T[new] and T[]. The differences between them are subtle (I have two > >>tables showing the primitives of T[] and T[new], which are very > >>similar). > > > >If T[new] is "array" and T[] is "slice" as I described them, I see no > >subtlety, they are huge differences, one is a dynamic array, the other is > >a view on somebody else's memory. > > Their primitives overlap 90% in syntax and semantics.
So what? Ranges and slices too. > >I know you probably hate when people says this (that's what I avoided > >doing it before :): > >I works very well in Python. You have arrays (well, lists, but the > >interface is the same as an array) and slices. I never heard anybody > >complaining about that being confusing. > > Python lists and slices are quite different from D arrays. Not the API. > >I don't see much problem. You should always return an array (T[new]) if > >you have one, because you can get an slice from it (the inverse is not > >true). Because of this, implicit conversion from array to slice can be > >a good idea, so people expecting a slice when an array is returned will > >never know an array was returned anyways. If you need to keep appending to > >the array, you can have the original array and keep appending to it > >without any performance hit (no copying, no new allocations). > > > >What's wrong with that? > > People expecting a slice and using "auto" or templates are in for a > rude awakening. Ok, you are in one of those days when you don't listen to reasons. I give up! =) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Si ella es el sol, yo soy la luna Si ella es el mar, soy el desierto Y estamos en eclipse total Y estamos en eclipse total