From: MonkeeSage Date: 2006-09-18T13:41:16+09:00 Subject: Re: A idea about Ruby module, can we degrade a class to a module Uncutstone Wu wrote: > But how about if Ruby provide a degradation mechanism, then we can > degrade a class to a module, then we can include the degraded class into > another class. The code will become as follows: Sounds kind of like you want a state pattern. Man is always a Person, but only sometimes is a Teacher. So when Man is in the "Teacher state", it has all the Teacher methods. Yes, you need some deligation/biolerplate code, but I think that is because the relationship is not as easy as you imagine. For example, is every Teacher a Man, or might some be a Woman? But if some Woman classes are already inheriting from Teacher, how will the modularization effect them? That's probably not a very clear example, but I think that the relationship is not so easy to define since it is not a 1-to-1 map of All A are B, but rathetr Some A are B, and some C are B, but no A are C. Something like that anyhow. Just ignore me if I make no sense. :) Regards, Jordan