In reply to Nicholas Matsakis's post: http://smallcultfollowing.com/babysteps/blog/2013/11/14/treating-vectors-like-any-other-container/
That's a really nice write-up Nicholas. I wanted to chip in because I had a think about some similar issues in the past, but your review is far more thorough and knowledgeable than I could have managed. Regarding Gc<[uint]> (or @[T]), this seems fairly useless to me, given that @mut[T] would not be memory safe (unless it is @mut ~[T] or reallocating the buffer is not allowed), thus the only way of constructing @[T] would be to coerce a ~[T] or a literal. For me, the biggest plus of your proposal is uniformity: e.g. someone could implement something like C++'s std::bitset and have it look syntactically equivalent to Vector<T> (although given that std::bitset is not very useful and Boost's "Pointer Containers" are redundant in both C++11 and Rust, I'm struggling to find an example where this is actually needed). Given the three big drawbacks (implementation effort, syntax and pattern matching) it may not be worth it. Using a builder trait to construct user-defined objects from literals is a nice approach (I believe it could also be useful in type-safe printf-like formatters and embedded DSLs for things like constructing HTML or parser rules), but some things like method lookup won't always be possible: let v : Vector<int> = [1,2,3].append_one( 4 )
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
