Any chance to call Tango as Extended Standard Library
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Jan 19 11:38:43 PST 2009
Jason House wrote:
> Andrei Alexandrescu wrote:
>
>> Speed is a small part of the equation, in fact a perk only. Ranges
>> are composable; you can combine them to e.g. do parallel iteration
>> over two ranges. Ranges really open std.algorithm to all data
>> structures. I find opApply incredibly obtuse and fostering bad
>> design. I wish it goes away.
>
> I'd really hate to see opApply go away. I'm glad Walter says it's
> sticking around ;)
I know. Its popularity is part of what makes it dangerous. It's to good
programming what fast food is to food :o).
> opApply is really nice in how *simple* it is to write. I think it's
> possible to use druntime's fibers to convert an opApply
> implementation into a range implementation. It'd be an interesting
> challenge to write a templated struct that handles all of this. Once
> that is done, maybe someone could discuss using Fibers to implement
> opApply in D2. I suspect the code inside an opApply would only
> change a little bit and it'd allow iteration over multiple "ranges"
> at the same time.
But that's making the mythical bear dance. Iterating over multiple
ranges is only one example. How do you feed one range to another range
with opApply?
At the end of the day, if what you want is to iterate, you need to
define what the state of iteration is, how to make a step, and how to
get to the current element being iterated. That is a good design, not
opApply and fibers!
Andrei
More information about the Digitalmars-d
mailing list