< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous artilce (have the same parent)
N :the next (in thread)
|<:the top of this thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
Hi,
In message "Re: proposal: class<<obj to invoke extend_object"
on 04/03/08, Simon Strandgaard <neoneye / adslhome.dk> writes:
|> Describe yourself deeper. What exactly is your proposal?
|
|When 'class<<obj' is seen by Ruby, then an init method should be invoked.
|I propose to reuse #extend_object and #extended for this.
|
|> And why do you think it's needed?
|
|Its difficult to add an new instance variable to obj.
|Its inflexible compared to obj.extend(Mod), because there isn't
|invoked an #extend_object method when the extension occurs.
You didn't explain why you need "extended" for singleton class
definition. Why don't you use extend for your purpose, before
changing the language?
|> Remember, since singleton class always exists for each object
|> (virtually), 'class <<obj' is rather corresponds to class re-opening.
|
|I am only little familiar with class re-opening..
I want you to take a break and learn about Ruby before claiming apples
and oranges are similar. Yes, they are. But not the same. Besides
that, singleton class definition is a kind of class re-opening, so
that they should remain same.
Class re-opening is a class definition whose target is an existing
class, for example:
class String
def foo # String#foo become available
end
end
there's no hook for class re-opening.
matz.