[Pharo-users] Re: Can traits be removed programatically?
> On 21 Nov 2021, at 14:21, s...@clipperadams.com wrote: > > I thought the question was how to install/duplicate the trait methods on each > client (maybe for a deployment image without Traits). I had the same > question. Doesn’t the suggestion remove the trait completely or am I missing > something? > This removes the Trait, yes… Removing in the sense of Flattening (that is, remove the Trait but change the class to contain the methods, e.g. to port to a system without Traits) is interesting.. it would be more like a refactoring… Marcus
[Pharo-users] Re: Can traits be removed programatically?
I thought the question was how to install/duplicate the trait methods on each client (maybe for a deployment image without Traits). I had the same question. Doesn’t the suggestion remove the trait completely or am I missing something?
[Pharo-users] Re: Can traits be removed programatically?
Hi Marcus, Thanks for your reply - very much appreciated. This is the approach I’ve taken and so far so good :) Cheers, J > On 3 Nov 2021, at 12:41 am, Marcus Denker wrote: > > You can just create > >> On 27 Oct 2021, at 11:07, Jupiter Jones wrote: >> >> Does anyone know how to remove a trait programatically? >> > > you could use the class installer / class builder, e.g. imagine you have: > > > Object subclass: #MyVisitor > uses: TRBProgramNodeVisitor > instanceVariableNames: '' > classVariableNames: '' > package: ‘PackageTest’ > > > you can now remove the Trait with: > > > ShiftClassInstaller make: [ :aClassBuilder | > aClassBuilder fillFor: MyVisitor. > aClassBuilder traitComposition: { } >] > > Marcus
[Pharo-users] Re: Can traits be removed programatically?
You can just create > On 27 Oct 2021, at 11:07, Jupiter Jones wrote: > > Does anyone know how to remove a trait programatically? > you could use the class installer / class builder, e.g. imagine you have: Object subclass: #MyVisitor uses: TRBProgramNodeVisitor instanceVariableNames: '' classVariableNames: '' package: ‘PackageTest’ you can now remove the Trait with: ShiftClassInstaller make: [ :aClassBuilder | aClassBuilder fillFor: MyVisitor. aClassBuilder traitComposition: { } ] Marcus