UML Modelling?
Andreas Raab
andreas.raab at gmx.de
Tue Feb 19 18:44:43 UTC 2008
itsme213 wrote:
> Traits use unimplemented self-calls as "required methods" to (among other
> things) access such state. However, you cannot parameterize these required
> methods (you can rename provided methods, but not required methods which
> would need some kind of automatic code generation/re-writing of intermediate
> traits).
Actually calling it "rename" is wrong. It's an "alias". If you're
wondering what the difference is, try this: Define a trait which has two
methods like
Trait named: #TSample
TSample>>foo
^self bar
TSample>>bar
^42
and then use it via, e.g.,
Object subclass: #TSampleTest
uses: TSample @ {#mumble->#bar}
At this point, I'd expect either of two things to happen for a "rename":
Preferredly, foo should call #mumble instead of #bar (since we renamed
#bar in the trait) or alternatively the class should simply have two
methods #foo and #bar.
What you get instead (and why it's not a "rename" but an "alias"
instead) is three methods: #foo, #bar, and #mumble with #mumble being
simply a copy of #bar. In other words, you have just created an alias
for #bar under the name of #mumble.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|