stéphane ducasse wrote:
Hi dean
do you ***really*** think that the Collection hierarchy is a toy example.... I'm not sure that we are talking about the same.
and
Cleaning your design does not solve the problem that traits solve. Read the papers. Sometimes we are forced to duplicate code or to write a lot of delegate methods just because we cannot simply reuse method dictionary. This is what traits are about.
There are ***really*** people who think something different than you. What about answering posts from them, especially if they try to think constructively about something that essentially you brought up, not with your laconic and annoying "read the papers". Otherwise people may learn and might have a laconic answer like "declined" for you in the future.
Here is what I think about the use of Traits in the Collection hierarchy:
- the Collection hierarchy works and there is no practical problem with its daily use. No problem is meant compared to other problems of Squeak. And if a problem shows up, it is usually of a philosophical nature like "Should a Set behave this or that way" and like all real philosophical problems it usually ignites a big discussion without any result. The dominance of philosophical problems with regard to Collections shows IMO that there is indeed no real problem with them.
- there is no understandability problem with them either. Again compared to other regions of Squeakland like e.g. the UI-library, the VM, or the application and its object oriented design you want to realize in Squeak. Of course you would have to think a bit to subclass let's say Set and find out how inheritance has been (mis)used to make it work, but that is a seldom and nonetheless minor problem. Generally everything within the Collection hierarchy is _very_ easy to understand.
- and there is no problem with the implementation of it, in the practical sense that a rare occurring bug is - once found - easily resolved.
All that makes Collections a really unconvincing example of what to gain from Traits. So for the Collection hierarchy it seems to boil down to a deal between space vs speed. You save space, but you lose speed.
- Such a deal alone should not be the reason for a language extension or change. Especially not for a really good and proven language like Smalltalk.
- Furthermore this deal is in the wrong direction! We desperately need speed, not space.
And that makes Collections a really bad candidate for illustrating the merits of Traits. For me this looks clearly like a counter-example.
Regards, Martin