> -----Original Message-----
> From: Robert Klemme [mailto:bob.news / gmx.net]
> "rolo" <rohitlodha / hotwireindia.com> 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?

Bytecodes. Vuby Bytecodes.
>
> 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.
>
Array might be good in terms that We can know at most of the places where
access with directly. To the places where the access is runtime based, we
can first lookup the index and the access it.

rolo