byKey and byValue: properties or methods?

bearophile bearophileHUGS at lycos.com
Tue Jan 17 16:10:31 PST 2012


Andrei Alexandrescu:

> > I'd like a byPair property too:
> > http://d.puremagic.com/issues/show_bug.cgi?id=5466
> 
> byPair is tricky because std.tuple is not visible from object.

I will add this answer to the issue 5466.

But I hope we'll have the unpacking syntax sugar for tuples. I think this too requires object to see tuples. There are functions in std.math that are better to return a tuple. While having complex numbers as built-in in D is not that useful for most people, I believe tuples are a basic language data type, even more than associative arrays :-)

By the way, I have already started using byKey/byValue ranges in my code, and I've already seen a speedup in some programs :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list