in reply to Class::Trait to the CPAN?

Personally, I have an actual production need for this. After I read the paper, I idly thought of implementing Class::Trait myself, (but am waaay too lazy).

I've got a Base class, called Object::Base. I've also got Object::Singleton and Object::ReadOnly. So, now, I want to be able to create a readonly singleton. Ok. Not a problem. Except, I don't want to create a Object::ReadOnlySingleton class. (I anticipate adding 3-4 other orthogonal attributes.)

The problem is depth-first method searching. There's some dovetailing between how O::Singleton and O::ReadOnly do their work. O::Singleton calls a method that O::ReadOnly overrides, and vice-versa. If I inherit from them both, I miss whichever is second in @ISA.

So, in short - yes, I want this. I'll be treating Traits as a neat implementation of Decorator, but it still works. :-)

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Class::Trait to the CPAN?
by chromatic (Archbishop) on Feb 17, 2004 at 00:28 UTC
    I'll be treating Traits as a neat implementation of Decorator

    That's what I did with Class::Roles (or whichever one I wrote) and Mail::Action. It's quite nice.