On 01/25/2013 10:31 AM, Era Scarecrow wrote:
> On Friday, 25 January 2013 at 14:43:01 UTC, Ali Çehreli wrote:
>> On 01/25/2013 06:22 AM, Don wrote:
>>> No, it's from 2002 (well, it was !==, renamed to !is in 2005).
>>> Bearophile only joined us about the time D2 began, in late 2007.
>>
>> Ok. How about !in then? Did he lobby for that one? :)
> //ummm feels like an AA. I'm sure if we used
> //it it would become second nature.
> if (ptr !in null)
Isn't that an error to apply the in operator to null? The expression
above is syntactic sugar for the following one:
!null.opBinaryRight!"in"(ptr))
Yes, there is also opBinary!"in" but it doesn't make sense to me to put
the container on the left-hand side ever:
if (myContainer in myElement)
Doesn't make sense.
> After looking at all these 'in' should be reserved for array searching,
> not pointer checking. It makes more sense to me that way.
Sorry if I implied otherwise. Yes, 'in' should be for that purpose. I
merely tried to remember what syntax has been bearophile's strong
suggestion. ;)
Ali