[squeak-dev] Re: Some questions about new traits (Crismas edition) ;
)
Andreas Raab
andreas.raab at gmx.de
Mon Dec 28 02:44:44 UTC 2009
Igor Stasenko wrote:
> 1. diff the number of lines between existing traits implementation & yours ?
It's a bit tricky to get a precise comparison, since Berne traits reuse
various methods across Kernel-Classes and Traits. OTOH, there are many
methods that will be removed from Kernel due to completely unnecessary
complexities. I think the real comparison can only be done if you look
at the totals of Kernel+[Nano]Traits before and after and since I
haven't done the cleanup yet there is a bit of a problem in comparing
this precisely. But you give an idea, here is a bit of data measured as
follows:
#('Traits' 'Traits-Kernel' 'Traits-Kernel-Traits' 'Traits-Composition'
'NanoTraits-Kernel' 'NanoTraits-Tests') do:[:pkgName| | pkg |
pkg := PackageInfo named: pkgName.
Transcript cr; show: pkg name;
tab; show: pkg classes size;
tab; show: pkg methods size.
].
Package Classes Methods
Traits 59 873
Traits-Kernel 22 343
Traits-Kernel-Traits 17 215
Traits-Composition 7 127
NanoTraits-Kernel 9 190
NanoTraits-Tests 9 122
The "meat" for NanoTraits is 9 classes and 190 methods And, after
installing NanoTraits there will be many other methods removed in
Behavior and friends which are only the result of unnecessary complexity
in Berned traits. It will be *significantly* simpler by any measures and
unloadable.
> 2. tools support, MC, Browser etc ?
Same as before. Slightly better on older systems (i.e., 3.8 based)
because browsers can cope with traits as is and mostly don't need
special support (i.e., using #classSide etc).
> 3. are there some common protocols with old traits, so one could use
> traits for metaprogramming?
As far as black-box reuse is concerned, there is no difference at all.
There is also plenty of common stuff for the internals but it's very
hard to know which protocols a particular client would use.
> I haven't time to take a look at your code. But if it is smaller &
> less complex than current version, i will vote for it.
Try it. Load it via:
(Installer repository: 'http://www.squeaksource.com/NanoTraits')
install: 'NanoTraits-Kernel';
install: 'NanoTraits-Tests'.
then install it using:
NanoTrait install.
(WARNING: Be prepared to throw the image away if something goes wrong)
> I just have some concerns about common protocols, so developers could
> use traits in both pharo & squeak without need of refactoring.
Fair enough. I don't think there's much difficulty as far as extending
the existing protocols go. We could even add compatibility traits
(TCompilingBehavior etc) that model the old structure if people want to
add extension methods to those.
And hey, my code is always MIT, so if the Pharo folks are interested,
tell them they're more than welcome to use and enhance it. The
squeaksource repository is world-writable.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|