In expression for array

Bill Baxter dnewsgroup at billbaxter.com
Wed Jan 23 21:32:44 PST 2008


BCS wrote:
> Reply to kede,
> 
>> Hi All,
>>
>> How about adding In expressions for general arrays in addition to
>> assoc arrays:
>>
>> if ('i' in eyes)
>> ...
>> as a simple replacement for the more verbose
>> foreach(c; eyes)
>> if (c == 'i')
>> ...
>> I think its a common enough pattern to warrant inclusion?
>>
>> Have fun,
>> kede
> 
> this suggestion comes up about every other month, gets thrashed about 
> (pros, cons, etc.) until everyone losses interest and then dies the same 
> (un implemented) death.


But the last discussion was archived in bugzilla:

http://d.puremagic.com/issues/show_bug.cgi?id=1323

Summary: some people (including Walter, I believe) think that, if 
implemented at all,  "x in some_array" should be equivalent to "x>=0 && 
x<some_array.length".

--bb



More information about the Digitalmars-d mailing list