Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-20 Thread Corey Richardson
I agree, this is the best solution to the problem I think. On Fri, Jul 19, 2013 at 4:28 PM, Niko Matsakis wrote: > On Thu, Jul 18, 2013 at 03:28:02PM -0400, Benjamin Striegel wrote: >> I think at the least we should offer a #[deriving(Basics)] for use on >> public types so that people aren't forc

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-19 Thread Niko Matsakis
On Thu, Jul 18, 2013 at 03:28:02PM -0400, Benjamin Striegel wrote: > I think at the least we should offer a #[deriving(Basics)] for use on > public types so that people aren't forced to memorize "Eq Ord TotalOrd > TotalEq IterBytes Clone" (unless we can find a silly SFINAE-esque > acronym... http:/

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Huon Wilson
On 19/07/13 05:39, Corey Richardson wrote: On Thu, Jul 18, 2013 at 3:33 PM, Daniel Micay wrote: Plenty of types can't actually be ordered, and in *many* cases not all fields should be considered for equality/ordering and they may or may not be listed in the order the comparison should try. I'

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Daniel Micay
On Thu, Jul 18, 2013 at 3:39 PM, Corey Richardson wrote: > On Thu, Jul 18, 2013 at 3:33 PM, Daniel Micay wrote: >> Plenty of types can't actually be ordered, and in *many* cases not all >> fields should be considered for equality/ordering and they may or may >> not be listed in the order the comp

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Corey Richardson
On Thu, Jul 18, 2013 at 3:33 PM, Daniel Micay wrote: > Plenty of types can't actually be ordered, and in *many* cases not all > fields should be considered for equality/ordering and they may or may > not be listed in the order the comparison should try. > I've wanted like #[deriving(Ord(a, b), Eq

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Daniel Micay
On Thu, Jul 18, 2013 at 3:28 PM, Benjamin Striegel wrote: > I think at the least we should offer a #[deriving(Basics)] for use on public > types so that people aren't forced to memorize "Eq Ord TotalOrd TotalEq > IterBytes Clone" (unless we can find a silly SFINAE-esque acronym... > http://www.wor

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Benjamin Striegel
I think at the least we should offer a #[deriving(Basics)] for use on public types so that people aren't forced to memorize "Eq Ord TotalOrd TotalEq IterBytes Clone" (unless we can find a silly SFINAE-esque acronym... http://www.wordsmith.org/anagram/anagram.cgi?anagram=eottic ). On Thu, Jul 18,

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Daniel Micay
On Thu, Jul 18, 2013 at 3:06 PM, Corey Richardson wrote: > On Thu, Jul 18, 2013 at 2:15 PM, Brian Anderson wrote: >> >> I disagree with the premise. There are any number of valid traits that >> library authors can forget to implement. Clone isn't special here. >> > > Thinking about it more over l

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Patrick Walton
On 7/18/13 12:06 PM, Corey Richardson wrote: Thinking about it more over lunch I came to the same conclusion: we need a generic way to automatically derive trait implementations for types which are eligible. #[deriving(Eq, Ord, TotalOrd, TotalEq, IterBytes, Clone)] should be the default. Almost e

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Corey Richardson
On Thu, Jul 18, 2013 at 2:15 PM, Brian Anderson wrote: > > I disagree with the premise. There are any number of valid traits that > library authors can forget to implement. Clone isn't special here. > Thinking about it more over lunch I came to the same conclusion: we need a generic way to automa

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Brian Anderson
On 07/18/2013 04:24 AM, Corey Richardson wrote: So with decopy landed we now have no way to copy things that does not require author intervention. And I am ok with this! Clone is much more flexible, less magic, etc. I see one problem with this though: we have no way to copy things that does not r

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Daniel Micay
On Thu, Jul 18, 2013 at 7:24 AM, Corey Richardson wrote: > So with decopy landed we now have no way to copy things that does not > require author intervention. And I am ok with this! Clone is much more > flexible, less magic, etc. I see one problem with this though: we have > no way to copy things

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Marvin Löbel
Right, we already have opt-out, and having elementary functions like Clone predefined also has precedence in other languages. See java and the overwritable clone() method on Object for example. Am 18.07.2013 15:36 schrieb "Benjamin Striegel" : > I agree that this is a huge headache waiting to happ

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Jack Moffitt
> I'm hitting this in workcache and json now. Stuff that the author didn't > think to make cloneable or comparable impls for. Since I'm in the same > source tree now I can fix it, but if it was in a different crate I didn't > control, I'd be out of luck. After converting Servo to Rust 0.6, I had t

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Graydon Hoare
On 13-07-18 06:36 AM, Benjamin Striegel wrote: I agree that this is a huge headache waiting to happen. It's our own version of the const-correctness problem. It also occurs with other "obvious utility impls" like totalord and iterbytes, when someone decides to use a struct as a key in a hash o

Re: [rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Benjamin Striegel
I agree that this is a huge headache waiting to happen. It's our own version of the const-correctness problem. We do already have a notion of "opt-out" kinds via #[no_freeze] and #[no_send], so this isn't entirely unprecedented. It would also be good to know how often one needs custom copy behavi

[rust-dev] Automatic Clone Derivation Proposal

2013-07-18 Thread Corey Richardson
So with decopy landed we now have no way to copy things that does not require author intervention. And I am ok with this! Clone is much more flexible, less magic, etc. I see one problem with this though: we have no way to copy things that does not require author intervention. For example, I ran in