On 01/10/13 16:26, Oren Ben-Kiki wrote:
Perhaps if the type system was smart enough to provide a default implementation of the Default trait for everything that had the ToStr trait, and allowing overrides for specific types?

I know that currently this sort of inference is not supported, but it is intended that it would be possible in the future, right?

I think we should just replace ToStr and the #[deriving] with Default and a default method .to_str() on that trait, since ToStr's current design makes it very allocation-heavy (it has to allocate a new ~str for each subfield, rather than just appending to a common buffer as using the new format infrastructure would allow).


Also, not directly related to this exact discussion, but we could probably cope with having fewer format specifiers, e.g. format!("{:b}", true) could just be format!("{}", true), and similarly for `c`. (and even `s` itself!)

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to