Re:Rust 0.9 released
by zanny on Thursday January 09, 2014 @10:22PM
(#7034916)
Every language in the universe prefers composition over inheritance =P
[ Parent
| on HN ]
Re:Rust 0.9 released
by seanmcdirmid on Thursday January 09, 2014 @10:47PM
(#7034988)
Not very true.
Some languages prefer inheritance to express is-a relationships and composition to express has-a relationships. Some languages try to shoe horn is-a into being equivalent to has-a, but they usually have trouble expressing non-structural subtyping.
I find that when refactoring code, I often redefine is-a to has-a anyway.
is-a vehicle --> has 4 wheels
Runtime error: Motorcycle lacks 4 wheels
Re:Rust 0.9 released
by banachtarski on Thursday January 09, 2014 @10:52PM
(#7035008)
The ones that don't blossom into interface factories which make factory adapters of abstract factories. (I'm looking at you, Java)
For the lack of a nail,
throw new HorseshoeNailNotFoundException("no nails!");
For the lack of a horseshoe, EquestrianDoctor.getLocalInstance().getHorseDispatcher().shoot();
(...)
http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom...