Hi,

In message "Re: [ruby-core:23606] Re: Defining #name= at the class level"
    on Fri, 29 May 2009 08:00:31 +0900, Gregory Brown <gregory.t.brown / gmail.com> writes:

|Well, I think the problem here is that when you use attr_accessor at
|the class level, it re-writes name to point at an ivar.   Since
|Rubinius stores the name in an ivar in the first place, this causes a
|clash (because it expects @name to be the real name of the module).
|
|Do you still think that the code I showed before should work, considering this?

I admit I misunderstood your question at the first place.  This
problem actually contains two issues in one:

  * what should happen if the specified method already defined in the
    superclass.

    attr_accessor does nothing if the method is already define in the
    target class, but what if it is in the superclass?

    In my opinion, the behavior of attr_accessor should be change to
    either a) raise exception or cause error for overriding superclass
    method b) or remain silent without overriding attr access method.

  * since core component of Rubinius is defined by Ruby itself, it
    tends to be weaker to hacks using reflection such as this.  Should
    we do something to protect internal of the core?

    Currently, I have no idea on this yet.  Maybe we need selector
    namespace or something.  Until then, I recommend Rubinius to use
    instance variable names more tolerant to outside access.

							matz.