in operator generalization

Les Baker les_baker at REMOVEbellsouthREMOVE.net
Fri Mar 17 14:50:02 PST 2006


Looking through old NG posts I found this one by Ben Hinkle last year 
about extending the "in" operator to support static/dynamic arrays.

http://www.digitalmars.com/d/archives/digitalmars/D/25164

Was this ever totally dismissed?  It just seemed to fall off the radar. 
  I'm liking the concept though; I don't know how many times I've 
written loops in quickie utility programs just to hunt for a item and 
return it.  I would also additionally suggest (if it hasn't already 
been) that "in" be overloadable so that if D supports other data 
structures in the standard library that they can use that syntax as well.

The only disadvantage I can think of is that when a developer sees "in", 
he/she can't assume it's a constant time operation anymore.  I think the 
increase in utility outweights that though.

Thoughts?

Les Baker



More information about the Digitalmars-d mailing list