Any chance to call Tango as Extended Standard Library

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jan 18 18:54:02 PST 2009


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.

Why is it a step backwards? A given container may define a number of 
ranges. Arrays are deceivingly simple because they have one obvious way 
of iteration, but even for them you'd have to write:

int[] a;
foreach (element; a.retro) { ... }


Andrei



More information about the Digitalmars-d mailing list