On Thu, 07 Oct 2010 16:32:22 -0400, Don <[email protected]> wrote:

I actually see a very significant difference between 'in' on a compile-time array literal, vs 'in' on a static array. When all values are known, the compiler can make a perfect hash. So potentially it could be O(1).

But 'find' on a static array will run the same function which would be used for a dynamic array. The difference is theoretical ONLY -- the exact same asm instructions will be executed!

In fact, x in ["abc", "def"] could be supported by allowing implicit conversion from array literals to AA literals.
["abc", "def"] -----> ["abc" : 0, "def" : 1]

Let's first make literals not allocate heap data or else the big-O complexity don't matter at all :)

-Steve

Reply via email to