From: Robert Klemme Date: 2004-06-29T20:57:55+09:00 Subject: Re: Object as an array or hash? "rolo" schrieb im Newsbeitrag news:ACEPLIKLBKEMDDIELPKIKEIACIAA.rohitlodha@hotwireindia.com... > Hi > > I am currently implementing a VM for Ruby. The code shall be compiled in my > case. Compiled to what? Java bytecode? Did you look at those projects under way dealing with Java bytecode compilation and native compilation? > Currently, the instance variables are implemented as an hash table. In > complied form it can be also implemented as an array. > Both of the methods have its only drawbacks and advantages but no > limitations on implementing the ruby language as it is currently. > > Has anyone thought about which might be better in case of compiled code? A hash since you don't know at compile time how many instance variables there will be. You can't know beforehand since there is #instance_variable_set and ...get. Regards robert