compile-time opIndex

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 2 04:18:44 PST 2015


On 1/1/15 2:12 PM, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Jan 01, 2015 at 01:42:45PM -0500, Steven Schveighoffer via Digitalmars-d wrote:
>> And I'm also with you that if you don't have .key .value support, this
>> isn't worth having.
> [...]
>
> The way I see it, this is an acceptable compromise:
>
> 1) Have .byKeyValue in druntime, which returns a struct with .key and
> ..value;
>
> 2) Have .byPair in Phobos (via UFCS), which wraps around .byKeyValue and
> returns a Tuple of .key and .value.

You don't need to wrap, just reimplement (The _aaRange primitives are 
accessible, I tried it). I don't see any reason to nest these, and they 
can be unrelated. As I said before, you can shoehorn the primitives into 
whatever you want in Phobos.

So I'm more interested in getting the .byKeyValue, we can call it that 
if people like it better. I don't care at all what, if anything, goes 
into Phobos.

-Steve


More information about the Digitalmars-d mailing list