defining "in" What is the proper way in D2?

Timon Gehr timon.gehr at gmx.ch
Mon Sep 12 07:21:25 PDT 2011


On 09/12/2011 04:10 PM, Simen Kjaeraas wrote:
> On Mon, 12 Sep 2011 00:11:11 +0200, Timon Gehr <timon.gehr at gmx.ch> wrote:
>
>> I think the fact that "in" for AAs returns a pointer is a mistake and
>> ugly in the first place and any generic code that relies on any
>> container to return a raw internal pointer is flawed by itself imho.
>
> If D had a Nullable struct, that would likely be a much better return
> type for 'in'. The thing is, we do have a nullable!T type: T*.
>
> This is simply a case of having a wrench and needing a hammer.
>

This is a case of having a wrench, needing a hammer, finding a 
screwdriver and perform some surgery on it so that it can be used as 
both a screwdriver and a hammer.

'in' is a boolean predicate, except in D.


More information about the Digitalmars-d-learn mailing list