On Sunday 15 June 2008, Phil Cooper-king wrote:
> Hi I've been doing rails for a while, which was really my first
> introduction to ruby. I've found my self using ruby more and more and
> keep amazing my self about how cool it is, although I've got a few
> questions, or rather holes in my ruby knowledge, from rails doing a lot
> of stuff for you I think.
>
> 1. What does a double colon do in terms of class inheritance. ie.
> GameWindow < Gosu::Window ?

Nothing special. As always, it's used to access a constant defined in another 
class or module. In your specific example, it is used to access the Window 
class in the Gosu module so that the GameWindow class can inherit it. It is 
exactly the same as:

window = Gosu::Window

class GameWindow < window

> 2. Why would you want to use nested classes?
Personally, I use nested classes when the inner class is closey coupled to the 
outer and isn't meant to be used by itself(for example, it can be a helper 
class used by the implementation of the outer class and which isn't useful if 
used in other ways). They don't provide additional benefits, but make clearer 
the programmer's intent

> 3. Is it bad practice to define constance out of classes?
Constants defined outside classes are top level constants, so the answer 
depends on the meaning of the constant. If it is related to the application or 
library as a whole, it may make sense to define it globally (for example, a 
constant containing the application version). If it is specific of a class, 
put it there (for example, take the constants defined in class Regexp. They 
are meant to be used only in methods of that class, so it wouldn't make sense 
to define it globally).

> 4. How/Can you delete instance variables or objects?
It depends on what you exactly mean, but I'd say the answer is no. I don't 
think you can force an object to be garbage-collected, and you cant undefine 
an instance variable. What you can do is to make possible for the object to be 
garbage-collected by setting all variables which point to it to something else 
and set an instance variable to nil.

Stefano