[Grace-core] mixins..

Kim Bruce kim at cs.pomona.edu
Sun Jul 22 23:30:50 PDT 2012


No!

Kim



On Jul 22, 2012, at 9:23 PM, James Noble wrote:

> I was just teaching a tutorial about the Decorator Pattern
> and mentioned our old friend the mixing.  So, should
> Grace support the likes of 
> 
> class Mixin.new<C> {
>  inherits C
> } 
> 
> or alternatively
> 
> class Mixin.new(o) {
> inherits o 
> }
> 
> for what it's worth, the following works in minigrace:
> 
>> method mix(o) {
>>    return object {
>>            inherits o
>>            method foo {print ("FOO!"); super.foo}
>>    }
>> }
>> 
>> class Mixin.new(o) {
>>    inherits o
>>      method foo {print ("FOO!"); super.foo}
>> }
>> 
>> 
>> def b = object {
>>    method foo {print "BAR"}
>>    }
>> 
>> 
>> b.foo
>> mix(b).foo
>> Mixin.new(b).foo
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core



More information about the Grace-core mailing list