polypus wrote:
> ok i think this question and a few others reveal a fundamental confusion 
> that you have, so i'll take it from the beginning. forget modules for a 
> minute.

I'm not confused. Confusion would suggest I have some flawed knowledge, 
which would suggest that I have some knowledge at all, which isn't the 
case. This is a case where I'm downright *ignorant* :-)

> class X
>   @foo = 'mama'
>   def imethod
>     puts @foo
>   end
>   def self.cmethod
>     puts @foo
>   end
> end
... <snip>

I think I understand this much. I know that the specific implementations 
I've outlined above fail because the initialize method(s) aren't being 
called, and therefore nothing is being initialized. In a (tight!) 
nutshell, that seems to be the basic flaw.

The thing I'm trying to implement is pretty basic, so I'm very confident 
that variable names won't clash. In fact, method names *would* clash in 
a lot of cases as I find myself doing similar operations on different 
kinds of data, so I'm really trying to implement only instance variables 
in modules (or super classes, though I'm having a little trouble with my 
first googlings about how to use inheritance) and not methods.

So, is there a way to mix-in or inherit variables and have them 
initialize to a default state? I'm thinking this sounds like a job for 
super classes. I originally started doing this by googling for "multiple 
inheritance ruby", and that's when I found mixins, so that's why I 
started by asking about mixins.

Sorry, I just emanate noobiness :-)

-- 
Posted via http://www.ruby-forum.com/.