Consistency

via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 17 03:39:03 PST 2015


On Monday, 16 February 2015 at 13:10:44 UTC, Daniel Murphy wrote:
> "Marc Schütz" " wrote in message 
> news:iftpzvhoyxxqhbfsxull at forum.dlang.org...
>
>> To be really consistent,
>>     x in arr
>> would need to be equivalent to:
>>     (x >= 0) && (x < arr.length)
>>
>> `in` tests for the presence of a _key_ in AAs, and the 
>> equivalent notion of a key for arrays is an index.
>
> It's called 'in', not 'haskey'.  Is 3 in the array?  Is 7 in 
> the map? Everybody understands what it means and the whole 
> argument is nonsense.

I disagree with that; the difference between keys and values is 
pretty obvious to me, as is the analogy with indices (both go 
inside the []). But the entire discussion is pointless, because 
`in` will not be changed (and for good reasons!).


More information about the Digitalmars-d mailing list