[squeak-dev] Re: Re: How to copy method safely?

Sophie (itsme213) itsme213 at hotmail.com
Mon Nov 3 04:52:15 UTC 2008


"Matthew Fulmer" <tapplek at gmail.com> wrote in message
> On Sun, Nov 02, 2008 at 10:10:49PM -0600, Sophie (itsme213) wrote:
>> I have tried several combinations of poking around #methodDictionary,
>> #addSelector, even CompiledMethod>>#getSource fed to Compiler. I only
>> succeed in messing up things and getting a large red methods-list pane in 
>> my
>> browser window :-)

> Well, the easiest way is to copy-paste.

Ah, why didn't I think of that :-) I'd much prefer it programmed.

> What are you trying to do?

Migrate off traits to ease migration to Gemstone by (a) replacing the trait 
with a plain class, and (b) programatically pushing methods from that class 
into other classes.

> To copy class1 >> selector into class2:
>
> class2
>    compile: (class1 sourceCodeAt: selector)
>    classified: (class1 organization categoryOfElement: selector)
>

Many thanks, that did the trick !! Presumably it does the right thing with 
clearing method caches etc.

Is there an equivalent way to reverse it i.e. remove a method with known 
selector that I just added to class2?

- Sophie 






More information about the Squeak-dev mailing list