On 16/11/13 00:39, Oren Ben-Kiki wrote:
If the traits were polymorphic in the index type (instead of always expecting an integer), then one could use them to make hash tables use vector syntax (e.g., `hash["foo"] = 1`)... Ruby does that, for example. So something like bitset (with integer indices) isn't the only example.

Not sure whether we want to go that way, though...

Note that the traits in the blog posts are parameterised by the index type:

    trait Index<I, E> { fn index<'a>(&'a self, index: I) -> &'a E; }

Etc.


|Huon|

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to