[LRUG] Global methods vs. Kernel mixins

Rob Miller rob at bigfish.co.uk
Thu Jul 18 01:41:53 PDT 2013


> On 18-Jul-2013, at 1:21 PM, Rob Miller <rob at bigfish.co.uk> wrote:
>
> So what does this leaves us with? global methods defined in "main" 
> object are mixed into Object class as private instance methods and 
> hence are available everywhere but as private method (other than 
> object main itself).

Excellent, thanks — that definitely plugs a hole in my 
understanding. But I'm still partially stumped: if you define a 
*private* instance method in the Kernel module (as the example I posted 
does), given that the Kernel module gets mixed into Object, doesn't that 
mean that your method becomes a private instance method on Object — 
which achieves the same end result as if you'd just defined it globally?

Sorry, I know I'm being really thick here, I just feel like it hasn't 
quite fully clicked yet!

Best,
Rob



More information about the Chat mailing list