Thanks for the feedback everyone. It makes sense how things currently are for Rust.
Keep up the great work! -- Ziad On Sun, Mar 23, 2014 at 4:54 PM, Liigo Zhuang <[email protected]> wrote: > +1 > 2014年3月24日 上午5:46于 "Patrick Walton" <[email protected]>写道: > > On 3/23/14 2:19 PM, Ziad Hatahet wrote: >> >>> You wouldn't probably use this for each and every method, but what it >>> gives you is Go-style duck typing. >>> >>> Sure you can define a trait, but what if the struct you to pass to your >>> function does not implement it? I guess you would have to implement a >>> wrapper around it manually then. >>> >> >> I don't think Go-style duck typing turns out to be that useful in >> practice to solve this problem, because the chances that two >> independently-developed libraries that wanted to expose some functionality >> on their object, say, `Munge()`, would give the function exactly the same >> name and give exactly the same types to its arguments, (in the same order!) >> is astronomically small. >> >> In reality the primary benefit of Go-style duck typing is the ability to >> avoid having to type the name of the trait you're implementing at the >> implementation site. What you give up for this is the ability to provide >> extension methods: i.e. implementation of a trait for a type *outside* of >> the package that defined the type. This is a huge downside, and I don't >> think it's worth it on the whole; this is why Rust's traits are designed >> the way they are. >> >> Patrick >> >> _______________________________________________ >> Rust-dev mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/rust-dev >> > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
