2009/10/26 Alexandre Bergel <[email protected]>:
>>> For traits, requirements were programmatically inferred instead of
>>> using #explicitRequirement.
>>>
>> Not sure i understood.
>
> Is it really necessary that you provides 'self shouldBeImplemented' as
> method body?
>
yes, it is. :)
Trait , in this case covers the protocol without any gaps.
Which is good from design perspective i think, because developer who
never dealt with given trait before, could easily see what he should
care about.
Doing otherwise, you leaving him clueless and stealing his time, which
he will spend on (re)discovering the complete necessary behavior when
using this trait.
>> Is there a way to tell to not override the method automatically, if it
>> provided in base class?
>
>
> No that I know. But this goes against the idea of Traits. A class that
> uses a trait is rigorously equivalent to having the class implements
> the methods defined in the trait.
> As a consequence, if you trait defines a method 'foo self
> shouldBeImplemented' and your class C uses the trait, then 'C new foo'
> will execute 'self shouldBeImplemented', independently whether #foo
> was implemented or not in superclasses of C.
>
I disagree. It doesn't.
You already can exclude the trait's methods from composition, but only
explicitly and in direct way.
What i'm wanting is to have more flexible & little bit indirect way i.e.:
TraitDescription>> - anArrayOfSelectorsOrTrait
^TraitExclusion
with: self
exclusions: anArrayOfSelectorsOrTrait
Another thing is to have ' apply only once' option,
means that if particular trait has already used in one of
superclasses, then exclude it from composition.
> Cheers,
> Alexandre
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
--
Best regards,
Igor Stasenko AKA sig.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project