Re: [rust-dev] Will smart-pointer deref operator allow making iter::ByRef more generic?

2014-02-04 Thread Palmer Cox
Ah, I think I see. I was expecting that after the deref trait lands, that a type like Gc would transparently implement all of the traits that T implemented. I guess that is not the case. So, if you want to pass the pointer to a function that expects an instance of one of the traits implemented by T

Re: [rust-dev] Will smart-pointer deref operator allow making iter::ByRef more generic?

2014-02-03 Thread Bill Myers
I don't think so, because the fact that the particular instance of T implements the Deref trait cannot have any effect on the decorator code, since it's not in the bounds for T. What instead would work is to change the language so that if type Type implements Trait and all Trait methods take &s

[rust-dev] Will smart-pointer deref operator allow making iter::ByRef more generic?

2014-02-03 Thread Palmer Cox
Hi, I was looking at some structs in Rust that implement the Decorator pattern - structs that take some value, wrap it, and then provider the same interface as the value that they are wrapping while providing some extra behavior. BufferedReader is an example here - it takes another Reader and prov