adding traits programatically

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

adding traits programatically

EstebanLM
Hi,
I'm trying to add/remove traits from a class programatically and I have
a problem...
What I'm doing is, for instance:

NSProxy traitCompostition: TNSLogConsole.

and

NSProxy traitComposition: TNSLogNone.

(as a way to replace logging strategies)... but nothing happens...
bah... in the browser the class definition is affected, but the
application still works as if none changed... do I need to force a
class recompilation after changing trait composition? what I'm doing
wrong?

Cheers,
Esteban



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: adding traits programatically

Alexandre Bergel
Hi Esteban,

traitComposition: is a low level method that should not be accessed. I  
believe that #setTraitComposition: is what you're looking for:
        NSProxy setTraitComposition: {TNSLogConsole} asTraitComposition

Cheers,
Alexandre

On 11 Feb 2010, at 11:11, Esteban Lorenzano wrote:

> Hi,
> I'm trying to add/remove traits from a class programatically and I  
> have
> a problem...
> What I'm doing is, for instance:
>
> NSProxy traitCompostition: TNSLogConsole.
>
> and
>
> NSProxy traitComposition: TNSLogNone.
>
> (as a way to replace logging strategies)... but nothing happens...
> bah... in the browser the class definition is affected, but the
> application still works as if none changed... do I need to force a
> class recompilation after changing trait composition? what I'm doing
> wrong?
>
> Cheers,
> Esteban
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project