[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Object.private_instance_methods <--- Kernel.singleton_methods

ronald braswell

8/5/2007 4:14:00 PM




>From: "Robert Dober" <robert.dober@gmail.com>
>Reply-To: ruby-talk@ruby-lang.org
>To: ruby-talk@ruby-lang.org (ruby-talk ML)
>Subject: Re: Object.private_instance_methods <--- Kernel.singleton_methods
>Date: Sat, 4 Aug 2007 20:30:10 +0900
>
>On 8/4/07, ronald braswell <rpbraswell@hotmail.com> wrote:
> > How do the Kernel.singleton_methods get to be
> > Object.private_instance_methods?
>Are they? I do not think so, maybe you could rephrase your question, I
>am probably missing something.
>
>Cheers
>Robert
>
>
>--
>[...] as simple as possible, but no simpler.
>-- Attributed to Albert Einstein
>

The question was not a good one. I now understand that the Kernel singleton
methods are copies of private instance methods due to a call to
module_function on them. Kernel's private instance versions of the methods
get mixed in with Object as well as its public instance methods. I had not
noticed that Kernel had private instance variables of the same name as its
singleton methods.

Ron

_________________________________________________________________
More photos, more messages, more storage?get 2GB with Windows Live Hotmail.
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mi...


1 Answer

Robert Dober

8/5/2007 4:38:00 PM

0

On 8/5/07, ronald braswell <rpbraswell@hotmail.com> wrote:
>
>
>
> >From: "Robert Dober" <robert.dober@gmail.com>
> >Reply-To: ruby-talk@ruby-lang.org
> >To: ruby-talk@ruby-lang.org (ruby-talk ML)
> >Subject: Re: Object.private_instance_methods <--- Kernel.singleton_methods
> >Date: Sat, 4 Aug 2007 20:30:10 +0900
> >
> >On 8/4/07, ronald braswell <rpbraswell@hotmail.com> wrote:
> > > How do the Kernel.singleton_methods get to be
> > > Object.private_instance_methods?
> >Are they? I do not think so, maybe you could rephrase your question, I
> >am probably missing something.
> >
> >Cheers
> >Robert
> >
> >
> >--
> >[...] as simple as possible, but no simpler.
> >-- Attributed to Albert Einstein
> >
>
> The question was not a good one. I now understand that the Kernel singleton
> methods are copies of private instance methods due to a call to
> module_function on them. Kernel's private instance versions of the methods
> get mixed in with Object as well as its public instance methods. I had not
> noticed that Kernel had private instance variables of the same name as its
> singleton methods.
ah you meant the results, of course, I am the worst guesser of the world :)
R.
>
> Ron
>
> _________________________________________________________________
> More photos, more messages, more storage—get 2GB with Windows Live Hotmail.
> http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mi...
>
>
>


--
[...] as simple as possible, but no simpler.
-- Attributed to Albert Einstein