Re:Rust 0.9 released
by carterschonwald on Thursday January 09, 2014 @09:43PM
(#7034793)
ooh, is this like record subtyping? Have you seen ermine https://github.com/ermine-language or Ur/web? http://www.impredicative.com/ur/
[edit, on #rust it was explained to me that its only for pointers to structs, but thats fine by me]
If anyone is interested, the proposal for Rust is detailed in http://smallcultfollowing.com/babysteps/blog/2013/10/24/sing...
I think this is a good idea. It seems similar to Go's embedding: http://golang.org/doc/effective_go.html#embedding
The difference is that the base struct can call methods on the derived struct, whereas this is not possible with that kind of struct embedding. This is important for some use cases (e.g. the DOM or the render tree).
I see.
The good news is that's an extremely constrained sort of inheritance, very unlike traditional OO in that it doesn't have base classes--it's just a special extension to the trait (typeclass) system that allows you to require that structs begin with a certain set of fields. In fact, I don't even call it inheritance these days--I prefer the name "structural constraints".