dsimcha wrote:
== Quote from Bill Baxter ([email protected])'s article
On Mon, Jan 19, 2009 at 9:16 AM, Andrei Alexandrescu
<[email protected]> 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.
--bb

One point of clarification:  opApply isn't going to be deprecated anytime soon, 
is
it?

I hope to be able to deprecate it.

It seems like ranges still have a bunch of rough edges, and although I like
the idea in principle, I'm only willing to convert to ranges if I can define
iterable objects with the same level of syntactic sugar as opApply gives me.  
For
simple cases this is already true and I have begun converting some stuff.
However, for more complicated cases, opApply is still a lot more flexible.

Ranges do have a number of rough edges, and IMHO the best way to address those is to improve ranges, not keep opApply.


Andrei

Reply via email to