Glenn Parker wrote: > Avi Bryant wrote: > > > >>- instance variables that don't need to be predeclared with the class > > > > Not exactly as Ruby does, but you can simply add new instance variables > > to the class definition whenever you compile a method that uses a new > > one. > > Isn't that jumping the gun just a bit? An instance variable (in Ruby) > should not exist in an object until the line that assigns/creates it is > actually executed. It's a subtle point, but it could impact some types > of reflective programming. Maybe you can mask its existence somehow? Yes, pretty easily I'd think. For example: when you create a new instance in Smalltalk, all the instance variables start out initialized to Smalltalk's nil value (of class UndefinedObject). As soon as it was referenced or assigned to, that would get replaced with some Ruby value (possibly Ruby's nil, of class NilClass). So you could always tell for a given instance which instance variables already "exist" inside the Ruby semantics. You could also just use a hashtable for each instance to hold all of the variables, like Ruby does, but the fact that Smalltalk can do direct instance variable access ends up being a nice speed and memory gain, so I'd rather not give that up. Avi