From: "Peter C. Verhage" Date: 2004-09-14T18:04:54+09:00 Subject: Re: JRuby article James Britt wrote: > (I confess I have not taken the time to read the article, only skim it. > But the $camelCase stuff jumped out. There may be a good reason to use > globals, perhaps related to having to deal with some Java stuff; the > company you keep and all that. Otherwise, though, some of the code > looks bad.) Yes, they have a good reason for it. In JRuby it doesn't seem possible to create a Ruby class which directly inherits from a Java class. From the article: "The next bit of code may seem unusual to the Java programmer. We first define a global variable for the main calculator window by prefixing the identifier with a dollar sign ($). This class definition is known as an anonymous class in JRuby. Essentially, we want to create a class based on or inheriting from the object we've just created. (Due to limitations in the implementation of inheritance in JRuby, we cannot define a class that directly inherits from a Java class.) In defining our new subclass, we write an init method (since the initialize method has already been called in the creation of the $calculator object). We will need to call this method upon completing the class definition. (To some extent, this is akin to calling super() in a Java class constructor and then proceeding with the initialization of that class.)" Regards, Peter