From: "David A. Black" Date: 2004-02-16T06:59:09+09:00 Subject: Re: Methods outside classes Hi -- On Mon, 16 Feb 2004, Francis Hwang wrote: > Some languages draw hard distinctions between "methods", "functions", > "subroutines", etc., but Ruby's much more laid-back than that. You'll > notice a similar sort of looseness with @ and @@ variables, which can > act differently if they're declared at a global scope than if they're > declared within a class or method definition. I think the difference is mainly cosmetic, though. At the top level the default 'self' is an instance of Object, so if you assign to a top-level class variable, it belongs to Object. Similarly, if you assign to an instance variable at the top level, it belongs to the default object. There's a kind of bootstrapping of the environment going on, but I think it's consistent with the behavior of those variables all around (if less visible). David -- David A. Black dblack@wobblini.net