« Return to Thread: Real (trivial) mixins

Real (trivial) mixins

by Jeremy Tregunna-2 :: Rate this Message:

Reply to Author | View in Thread

Just thought I'd put this out there, topic came up in #io today about  
real mixins (not utilizing differential inheritance), so I set out to  
write them and realized that, it's extremely trivial. 5 lines of well  
structured code, or one line of still readable code. I'll put it in  
the former just because. :) It's presented below:

Object asMixin := method(
     self slotNames foreach(name,
         call sender setSlot(name, self getSlot(name))
     )
)

Enjoy.

Regards,

Jeremy Tregunna
jeremy.tregunna@...



 « Return to Thread: Real (trivial) mixins