On Tuesday, 1 May 2012 at 02:26:53 UTC, Alex Rønne Petersen
wrote:
On 01-05-2012 03:41, Jesse Phillips wrote:
Complexity of the operation. in on an array is not nearly the
same as
with an associative array.
I know, but it's very intuitive still; see Python.
And that's why it's somewhat dangerous. Because it's so easy to
use, someone that doesn't pay enough attention may overlook the
fact that he is not using the right data structure. If he often
has to do that more than once, he is using the wrong tool for the
job. I agree it would be syntaxically nice, but I worry giving
this syntactic sugar for what's a for loop with lots of
comparisons isn't such a good idea. And the comparisons
themselves are subject to caution. If for instance it's an array
of floats, or some custom objects, it's very unlikely that you
are going to compare bit by bit. So basically, this would be
useful only for integers and chars.