Name spaces in Spoon
Peter Crowther
Peter at ozzard.org
Sat May 27 07:21:20 UTC 2006
> From: Michael Latta
> The downside I see in having call context dependent behavior
> is that the
> reader of the code needs to know the run-time context that
> will modify the
> behavior of the object. The same result can be achieved with
> a wrapper
> object that implements the new methods, and passes on unknown
> methods to the delegate.
Consider the following: ClassA implements methodA as '^self'. ClassB, a
subclass of A, implements methodB as '^self methodA'. Now a module adds
methodA to ClassB (let's say it's '^self') and calls 'ClassB new
methodB'. The delegate case would call ClassA>>methodA, whereas the
'expected' behaviour is pobably a call of the module's methodA. There's
also an interesting discussion to be had about what class the returned
object would be - it could be ClassB or ClassB-delegate depending on how
this was implemented
This is not 'the same result', I think.
- Peter
More information about the Squeak-dev
mailing list
|