My understand was that a trait simply stuffs it's methods into the
class it is a part of, so afterwards it looks like one just
implemented the methods in the class as normal.
I'm sure there must be a way of catching entry and exit of a specific
method, though I'm not sure what you would have to do. Possibly some
byte code injection like how Aspects work in Java.
On Jan 8, 2008 11:31 PM, Tom Phoenix <
[hidden email]> wrote:
> On Jan 8, 2008 1:16 PM, itsme213 <
[hidden email]> wrote:
> > "Tom Phoenix" <
[hidden email]> wrote in message
> > > Or do you mean that you want to do something when a trait is first
> > > applied to a class?
> >
> > First applied.
>
> You could install a hook somewhere around the time the class is first
> instantiated, I suppose. But wouldn't that break some of the rules of
> traits, if there's more processing going on than what shows in the
> code of the trait itself?
>
> Maybe what you want is to have your trait use a class trait that would
> do some initialization?
>
> Good luck with it!
>
> --Tom Phoenix
>
>