Smalltalk Compiler, was Re: Objective-C Generation

Dana S. Wheeler dwheeler at gte.net
Fri Apr 14 03:59:06 UTC 2000


Marcel Weiher wrote:

> > From: "Jeff Szuhay" <jeffs at pstnet.com>
> > Is anybody working on generating Objective-C code
> > from Squeak?
>
> [raises hand]
>
> Yes.

Remainder of original message deleted

Since you have obviously thought deeply about this I was hoping to ask
you a couple of questions. I am new to smalltalk so please have
patience. Being frustrated with the speed of smalltalk compared to
languages that compile to native code I have been thinking about how
smalltalk could be optimized. It seems to me that :

    1. All classes can be decomposed to  primatives.
    2. Methods ultimatly can be decomposed to operations on those
primatives.

This would seem to imply that any valid smalltalk program could be
expressed in any language the primatives could be expressed in. The
monkey wrench in the works is that at this point you don't know what
class will be passed as an argument in a message to a given class.
However if the initial message that starts the application has no
arguments (CheckBookInterface new; open.) or the argument(s) to the
message can be decomposed into primatives then the you start a chain of
logic with which you can determine which objects are passed as arguments
in any message the application uses. Therefore you can determine which
message is being called since it depends upon the class. I've tried this
manually on a couple of small programs and while it was tedious it did
seem to work. However I have not done an exaustive trial, I am a newbie
and I am reminded of the saying "Logic is a way of going wrong with
confidence."

On the other hand if this works the possibilites are exciting. It also
seems to imply that any message that does not have arguments could be
compiled into native code and used by the object engine. This would
increase speed not only by using native code but also eliminates many
method look-up's by the object engine (virtual machine?).

If this works you would need only a library of primatives in your
favorite language. The translator would be able to trace the messages
from the application through the smalltalk library. Therefore you are
not tied to any one implementation of the smalltalk library.

Just imagine. The translation code could be written in smalltalk, then
run on itself and you would have a Just-In-Time compiler.

Actually this sounds to good to be true. Or is someone already doing
this. I heard that something like this is done in self but I have no
details.

My question is this: What situation would this not work and where am I
going wrong. I feel like I'm missing something.

Thanks

--
Dana S. Wheeler
dwheeler at gte.net

Maintain a humble awe in all things of God and a cynical skepticism in all
things of man.







More information about the Squeak-dev mailing list