"in" everywhere

Marianne Gagnon auria.mg at gmail.com
Thu Oct 7 09:38:31 PDT 2010


IMO this could be added, with the documentation specifying the implementation doesn't need to best fast. So people who want quick development for things that don't need high performance may use it, while people coding for performance just need not use it. The compiler may try to optimize it if it can.

I have seen python programs avoid the use of "in" since it was slower

About substring I don't know, though. But I think it makes sense for collections (arrays) and opIn or so could be added so other types of collections may use the "in" keyword perhaps

-- Auria

> On 10/7/10 6:54 CDT, atommixz wrote:
> I'm a bit leary of adopting this feature (it has been discussed). To me 
> "in" implies a fast operation and substring searching isn't quite it.
> 
> One thing that could be done is to allow "in" with literal arrays to 
> their right:
> 
> if (x in ["abcde", "asd"]) { ... }
> 
> The size of the operand is constant, known, and visible.
> 
> 
> Andrei



More information about the Digitalmars-d mailing list