Any chance to call Tango as Extended Standard Library
Sergey Gromov
snake.scaly at gmail.com
Mon Jan 19 05:42:00 PST 2009
Mon, 19 Jan 2009 09:47:14 +0900, Bill Baxter wrote:
> On Mon, Jan 19, 2009 at 9:16 AM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>>> Unless it's a class you mean?
>>
>> Yah, ranges are meant to have value semantics. If you have a class container
>> exposing ranges, define the range separately from the container itself:
>>
>> MyIterable collection;
>> foreach (element; collection.all) {}
>> foreach (element; collection.all) {}
>
> Add .opRange so that's not necessary? Or allow opApply to return a range?
> Otherwise it looks like a step backwards.
I already proposed that foreach should first try collection.opSlice()
and work with that if successful, otherwise resort to iterating over the
collection itself. You would probably implement opSlice anyway so this
solution comes at little cost.
More information about the Digitalmars-d
mailing list