On Sat, 23 Oct 2010, Stéphane Ducasse wrote:
There was a discussion here a few weeks ago concerning a Trait I proposed called
TComparable. It is the protocol of Magnitude bundled separately as a Trait, so any class
can behave like Magnitude without having to inherit from Magnitude or use composition.
You need only add "uses: TComparable" to the class template and then override
its abstract methods as needed, and instances of your class will now be comparable.
Association could use TComparable rather than inheriting from Magnitude, and, if the
build system permits, Magnitude itself could be rewritten to use TComparable. Stef.
approved of the idea and expressed a desire to see it in upcoming versions of Pharo, but
I am not sure what the current status is.
That's a nice solution, but it means that Traits have to be in the Kernel. I
have three problems with Traits:
1) they are stateless
2) they are different from classes
3) incomplete tools support (this may be fixed in Pharo, but I doubt it is)
1) we build some code to see if we really need state and this is not that
obvious and adding state is not trivial
Not trivial? Maybe not, but only a little bit harder than trivial.
2) well, this is difficult to get the money for the butter and the butter - we
are trying.
If you can compose classes the way you can add a trait to a class now
with class and optional method level instance+class variable mapping, then
you're done. It would be a lot simpler to use it _and_ it would also be a
lot easier to implement it. Especially the tools part.
3) again if nobody does anything and we just all cry on ourselves then nothing
will happen.
Tools are a must. No tools - no users.
So for now identifying traits and learning is the way. Then we can refactor,
redesign
Well, Traits are in Squeak since 2006, IIRC they were available a few
years earlier. So in the last X (at least 4) years the only good
candidate to become a Trait was Magnitude.
Levente
Stef
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project