Writing a simulation library with this linguistic feature has a completely different feel to it. The job is more about writing many orthogonal qualities, and using classes just as handy pre-packaged combinations of qualities. If classes are nouns, then qualities are like adjectives. I call it quality-oriented programming.
For example, let's take a "MUD" style simulation (though I've used this for other types of sims):
quality Living; // has a life force quality Anatomical; // has a collection of body parts quality Breathing; // has limited range outside atmosphere quality Mortal; // can die quality Injurable; // can be wounded quality Motivated; // has goals // ... and so on class Item; class Thing is a Massive Palpable Item; class Lifeform is a Living Anatomical Thing; class Animal is a Breathing Mortal Injurable Motivated Emotional Gendered Lifeform; class Mammal is a Visible Viewing Eating Drinking Listening Smelling Smelly Feeling Animal; class Primate is a Wearing Manipulating Gestural Facial Wielding Mammal; class Human is a Sentient Carrying Talking Skilled Primate;
Note here that the qualities carry ALL of the implementation and the class definitions are completely nil. These nil classes just indicate the list of qualities to be attached upon instantiation. Also, there's no problem with removing Vocal from a particularly pesky individual Human for a while, even if she were instantiated with that quality.
I've implemented this mechanism in C++, Java and pure Perl; the pure-perl implementation has the highest overhead of course, but I find it the nicest overall language for developing custom object models.
--
[ e d @ h a l l e y . c c ]
In reply to Re^3: Informal Poll: why aren't you using traits?
by halley
in thread Informal Poll: why aren't you using traits?
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |