[squeak-dev] Re: Traits on Gemstone

Matthew Fulmer tapplek at gmail.com
Thu Nov 6 01:30:23 UTC 2008


On Mon, Nov 03, 2008 at 03:58:35PM -0700, Matthew Fulmer wrote:
> On Sun, Nov 02, 2008 at 10:52:15PM -0600, Sophie (itsme213) wrote:
> > "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.
> 
> Traits support flattening, which means that you leave all the
> traits methods in the class, but forget that they came from
> elsewhere. To remove the traits from a class, but leave the
> methods alone, I think you just do this:
> 
> aClass purgeLocalSelectors
> aClass traitComposition: nil

Here's a cleaner way to do it:

aClass flattenDownAllTraits

-- 
Matthew Fulmer -- http://mtfulmer.wordpress.com/



More information about the Squeak-dev mailing list