Hello Michel,

I agree that it'd be handy to have 'in' and '!in' work with arrays,
especially with array literals:

if (x in [1,2,5,6,10]) do(something);

Perhaps this syntax could be allowed but only for array literals. The
reason being that array literals are usually short so a linear search
wouldn't be too bad. Moreover, an array literal being a literal, it's
easy for the compiler to optimize things; you're not constrained to a
linear search.


How about expanding that to compile time constants of any kind. From that, even with long arrays, you should always be able to get n-log(n) performance (tree search) or better (translate it into a normal AA 'in' or even a perfect hash).
--
... <IXOYE><



Reply via email to