[rust-dev] RFC: Opt-in builtin traits
com.liigo at gmail.com
Sat Mar 1 18:46:52 PST 2014
I like this
2014年3月2日 上午4:07于 "Niko Matsakis" <niko at alum.mit.edu>写道：
> On Fri, Feb 28, 2014 at 11:23:23PM -0800, Kevin Ballard wrote:
> > I'm also slightly concerned that #[deriving(Data)] gives the
> > impression that there's a trait Data, so maybe that should be
> > lowercased as in #[deriving(data)], or even just
> > #[deriving(builtin)], but this is a lesser concern and somewhat
> > bike-sheddy.
> This is definitely bikeshedding, but that's important too. While we're
> bikeshedding, I think we ought to rename the trait `Pod`, which
> doesn't fit into our "verb" scheme:
> My first thought is to resurrect `Copy`, though of course it's very
> similar to `Clone`. Anyway, let's assume for now we rename `Pod` to `Copy`.
> In that case, I think I would have the following "trait sets":
> data = Eq, Ord, Clone, Freeze, Hash, Share <-- Note: not Copy!
> pod = data, Copy
> The idea is that almost all types (hashtables, etc) can use `data` (in
> particular, `data` is applicable to types with `~` pointers). Very
> simple types like `Point` can use `pod` (which is, after all, just
> "plain old" data).
> Rust-dev mailing list
> Rust-dev at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rust-dev