From: Avi Bryant Date: 2005-04-09T00:49:41+09:00 Subject: Re: Seven new VMs, all in a row Patrick Down wrote: > What about systems like Rails where members are added to the class > definition at runtime from a database definition? ( I assume that's how > it works. ) If you're talking about methods, that's no problem at all - like Ruby, Smalltalk makes no distinction between compile-time and runtime (in fact, Smalltalk environments don't even make a distinction between edit-time and runtime), so adding (or removing, or modifying) methods at "runtime" is the usual case. If you're talking about instance variables: when you add a new instance variable to a class, the system walks through all of the old instances of that class and makes a new copy with space allocated for the new inst var. The next step, which requires VM support, is to do an atomic swap of all of the old instances for all of the new instances (some Smalltalks can do this faster than others, but in the worst case it requires a full garbage collection). My guess is that for almost all applications, the occasional added cost when adding inst vars would be more than made up for by the increased speed when accessing them, and the reduced memory consumption (and thus reduced load on the GC). Avi