Hi Oliver, Glad you're liking Rust so far :)
Currently traits can only have methods (functions that have a self parameter) and associated functions (functions without a self parameter). There's a proposal to add inheritance on structs to Rust, which would allow a trait to extend a struct and gain access to its fields. This (very) long mailing list thread<https://mail.mozilla.org/pipermail/rust-dev/2013-November/006465.html>is the most recent discussion I'm aware of. There are a couple ideas in there about how to get similar behavior using just existing Rust constructs (I'm still biased towards the solution I gave in there). I'm not aware of any plans for a rust-users forum. Maybe spinning a rust-users mailing list off from rust-dev would make sense? We already did a similar thing with our IRC channels. Eric On Mon, Dec 2, 2013 at 2:12 AM, <jeti...@web.de> wrote: > Hello, > > I lately had a look at Rust and really liked it in many ways. Rust has > really everything I'm missing in Go ;-). There is something about traits I > would like to ask I can't see from the manual. Question is whether you > define instance variables in traits or abstract variables like Ceylon and > Kotlin have them. Abstract traits vars in Kotlin look like this (sample > code taken from here: > http://blog.jetbrains.com/kotlin/2011/08/multiple-inheritance-part-2-possible-directions > ): > > trait Trait { > val property : Int // abstract > fun foo() { > print(property) > } > } > class C() : Trait { > override val property : Int = 239 > } > > Can something like this be done for traits in Rust as well? > > Then I would like to ask whether you are planning to have some Rust forum > for users. The question I was asking in this mail on rust-dev really > doesn't belong into the dev mailing list. So something like a google > Rust-users newsgroup would be a good thing to have. I know several people > that are interested in Rush. Think it would give Rust a little push if a > Rust-user forum would exist. > > Regards, Oliver > > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev > >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev