Hi rustics, I spent some time this weekend going over the rust tutorial and documentation for 0.3.1. I thought a fun exercise would be writing an xUnit testing framework[1] in a "classic" OO style. I ran into a few problems:
1) xUnit historically relies on inheritance but it's not clear to me how to model an is-a relationship in Rust. For instance, define an abstract base class (TestSuite) and an implementation that tests a set of functions (say, a calculator). 2) How to colocate state and behavior in impls. Embedding lets in my impls results in errors. 3) Reflection. I have no documented way to iterate over the functions in an impl and call them. (I'm sure this is on the way and I'm just early to the party) I also think I'm approaching this from the wrong direction and that Rust's OO with typeclasses are different from how I'm using to building software in another language with typeclasses (Scala). I'm still looking for the zen of Rust OO. I ran into some old blog posts that discuss a class keyword but I wasn't able to make those examples run in 0.3.1. Do we only have impls now? I realize that Rust is young and moving quickly but I'm struggling to build something that's more than a few functions and an enum. Thanks a bunch, Steve [1] http://en.wikipedia.org/wiki/XUnit _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
