Metaclass JVM programming

Claus Spitzer DocBoobenstein at gmail.com
Fri Oct 29 22:00:58 UTC 2004


Greetings!
I am implementing a Java VM in Squeak, and am trying to figure out how
to represent Java concepts in Smalltalk. Here's the idea I had so far:

1) Create Squeak classes for everything that needs to be represented
(e.g. JavaClass, JavaInterface, &c.).
2) Instances fo these classes would be Java classes. So if Java had
class Foo, then Foo would be an instance of the JavaClass class. These
would have to be, I assume, singletons.
3) Instances of instances... ?
Now this is where I thought of metaclasses. I recall that in the first
Smalltalk paper I read it was mentioned that all Smalltalk classes are
instances of their respective metaclass, and that metaclasses are in
turn instances of metaclass-class. So I was hoping to change 1) to be
metaclasses... then 2) would be classes, and instances of these would
be, well, instances. Is this feasible? Or would it be possible to make
the instances of the classes in 1) behave like classes in turn (that
is, make instances of the instances in 2) )?

In short, I'm thinking of 2 solutions to the problem presented above:
 - To make a metaclasses for the Java concepts. While this makes it
easier for me an those I work with to wrap our heads around, it seems
like a waste (Since in that case the Java classes would each be
represented by a Smalltalk class).
 - To have instances of a class behave like classes themselves. This
feels 'more right', but I'm afraid that I'm not experienced enough
with Squeak to know how this is to be done (and if it is even
possible). Could anyone give me some hints regarding this (perhaps
direct me to the right paper/site covering these topics?).

Regards....
   -CWS



More information about the Squeak-dev mailing list