DIP67: Associative Ranges
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Wed Oct 29 11:04:28 PDT 2014
On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh via
Digitalmars-d wrote:
> On Wed, Oct 29, 2014 at 05:23:07PM +0000, Brad Anderson via
> Digitalmars-d wrote:
>> On Wednesday, 29 October 2014 at 06:59:09 UTC, bearophile
>> wrote:
>> >This is very false. I have tons of cases where you only
>> >iterate on
>> >values or keys. On the other hand I have suggested several
>> >times that
>> >I'd like a byPairs (that yields keys-values tuple pairs).
>> >
>>
>> It happens to me too but it's very much a minority of uses.
>> Having
>> sets as well as maps would help replace some of these cases.
>> Not all,
>> of course.
>>
>> >
>> >>Doing byKey requires you to do a lookup to get the
>> >>corresponding
>> >>value which just takes up cycles unnecessarily.
>> >
>> >Usually people use a "AA.byKey.zip(AA.byValue)" that is not
>> >reliable.
>>
>> Better than doing key lookups on every iteration but awfully
>> ugly and
>> should be unnecessary. byPairs sounds good.
>
> I've submitted a PR for byPair before, but it was roadblocked
> by the
> fact that people demand that it return std.typecons.Tuple, yet
> we're not
> allowed to import Phobos in druntime. Other than this IMO
> nitpicky
> issue, the code was already all ready to go many moons ago.
>
>
> T
Can byPair be implemented in phobos, or does it need to access
private/package stuff in druntime?
More information about the Digitalmars-d
mailing list