On Mon, Feb 16, 2009 at 3:18 AM, James Coglan <jcoglan / googlemail.com> wrote:
> 2009/2/16 Trans <transfire / gmail.com>
>
>>
>>
>> On Feb 15, 2:17 pm, James Coglan <jcog... / googlemail.com> wrote:
>> > > Great. However, I also want the end-user of this library to be able
>> > > effect all classes and modules with a single extend (or include) as
>> > > well, if they so choose. Eg.
>> >
>> > >    class Module
>> > >      include MyEnhancement
>> > >    end
>> >
>> > I came up with this a while ago:http://gist.github.com/25104. It's a
>> pretty
>> > big hack but lets you write modules that override the behaviour of
>> classes
>> > they're mixed into.
>>
>> Sort of like a traits system?
>
>
>
> I'm afraid I don't know enough about traits and how they differ from mixins
> to be able to answer that. In fact, if you know of any good reference
> material on traits I'd quite like to give it a read.
Sure, the cannonical text can be found here:
http://www.iam.unibe.ch/~scg/Archive/PhD/schaerli-phd.pdf

and I have implemented it here:
http://rubyforge.org/projects/ruby-traits/

N.B. For 1.9 the implementation becomes even simpler.
Cheers
R.