[squeak-dev] Re: Two methods sharing source code?

Adrian Kuhn akuhn at iam.unibe.ch
Thu May 29 19:00:05 UTC 2008


Martin Beck <martin.beck <at> hpi.uni-potsdam.de> writes:

> 
> Hi there,
> for some reasons, I want to have two methods sharing the same source 
> code base. So if I change one method within the browser, the other would 
> change, too. Is this possible in Squeak? And, would the usual tools work 
> with that?
> 
> Regards,
> Martin
> 
> 
 
It is as simple as (iff you ignore tool support)

	A compile: 'foo ^ 42'.
	m := A methodDict at: #foo.
	B methodDict at: #bar putNoBecome: m.
	B new bar. "=> 42"

(at hard-core squeakers, why does a simple #at:put: not work?)

cheers,
AA






More information about the Squeak-dev mailing list