On 7/2/13 8:45 AM, Michael Neumann wrote:
Am 02.07.2013 17:29, schrieb Alex Crichton:I was looking for something like: static h:HashMap<K,C> = {(K,V),(K,V).....}. Is this possible at all?What would be much easier is to use a sorted array and binary search for lookup. But sorting at compile time seams to be tricky, for simple values ok, but for more complex keys I think it's impossible.
A procedural macro (what we call a syntax extension) could do it. I've been thinking for a while that we should have such a syntax extension in the compiler. This is needed in Servo for "pre-interned identifiers": think well-known DOM attributes like "id" or HTML elements like "img".
Patrick _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
