Hi,
In message "Re: Fwd: [suby-ruby] Your all time desired fundemental Ruby mod"
on Mon, 17 Jan 2005 23:22:30 +0900, "trans. (T. Onoma)" <transami / runbox.com> writes:
|I want to expand the functionality of this class with a module I have:
|
| module M
| def x ; @x ; end
| end
|
|But @x needs to default to an array. So what do I do? Presently I have two
|choices. Either change M to:
|
| module M
| def x ; @x ||= [] ; end
| end
|
|or use super as you suggest. But I don;t want to just recopy C for what if it
|changed internally later?
Initializing module instance variables are one of the things I want to
fix. But I'm not sure what is the best way to fix. Maybe AOP-like
hooks is the way to go. I'm waiting the conviction to come.
matz.