From: "Adam P. Jenkins" Date: 2005-07-21T01:30:56+09:00 Subject: Re: Ruby/Rails as a starter language? gwtmp01@mac.com wrote: > > On Jul 19, 2005, at 7:20 PM, Daniel Amelang wrote: > >>> In Java, classes aren't objects. >>> >> >> Sorry Hal: >> http://java.sun.com/docs/books/tutorial/reflect/class/index.html > > > In Java, the "class" objects that can be examined at run-time > via the Reflection API are just static data-structures that > describe the source code used to create the run-time. > > I'm sure I'll be corrected but the distinction between Ruby and Java > here is that in Ruby the "class object" is "alive" and is in > fact part of the run-time of the system. If you modify a > class object, you modify the run-time behavior of the system. > In Ruby you get to play in the wacky world of "self-modifying" code. > > In Java the "class objects" are a dead, static representation of > the code used to create the runtime. Even if you could modify > those data structures that wouldn't affect the run-time behavior > of the system. You might as well try to affect the run-time > system by reading and writing the source code files. You're trying to make the distinction more profound than it really is. Class objects in Java are immutable, which I think is what you mean by "dead". So would you say Ruby Fixnums aren't really objects because they're immutable? Java, Python, and Smalltalk all have immutable string classes; would you say they're not really objects? Java certainly has class objects, you just can't do as much with them as you can in Smalltalk or Ruby. In particular you can't modify class objects at runtime. I believe that mutable class objects in the Ruby/Smalltalk sense are incompatible with statically typed languages, so really whether you realize it or not, you're arguing for dynamic typing over static typing. Adam