On Sat, 6 Dec 2003 02:50:19 +0900, T. Onoma wrote: > On Friday 05 December 2003 06:41 pm, Austin Ziegler wrote: >> That's fine for subclassing, but what about mix-ins? >> class A >> def initialise >> @__checkpoint__ = True >> end >> end >> A.new.extend(Transaction::Simple) > I need clarification on this. Using extend doesn't add a mix-in, but > rather a singleton. Right? I'm not debunking austin's point or anything, > I just need to be clear on this b/c I've seen it refered to as a mix-in > before and I don't think that's percise. So I just want to make sure. It is a mix-in. class A; end class B; include Transaction::Simple; end x = A.new y = B.new x.extend(Transaction::Simple) class << x; self; end.ancestors => [Transaction::Simple, A, Object, Kernel] class << y; self; end.ancestors => [B, Transaction::Simple, Object, Kernel] It's just that #extend mixes into the object's singleton class. -austin -- austin ziegler * austin / halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2003.12.05 * 12.58.42