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

Igor Stasenko siguctua at gmail.com
Fri May 30 13:05:52 UTC 2008


2008/5/29 Adrian Kuhn <akuhn at iam.unibe.ch>:
> 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?)
>
You need to notify VM to flush method cache, so simple #at:put: may
lead to unexpected results.
> cheers,
> AA
>
>
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list