I was wondering ...

Christian Brunschen cb at df.lth.se
Wed Jun 23 08:10:36 UTC 1999


On Wed, 23 Jun 1999, Marcel Weiher wrote:

> I've actually written a prototype modification to the C translator  
> to make it spit out real Objective-C class definitions and code.  

Cool :)

> The  
> idea is to have something inbetween current C-translatable code and  
> full Smalltalk so, for example, plugin code can be written in almost  
> normal Smalltalk, or even better, it is possible to annotate  
> Smalltalk code to make it translatable/compilable.

  One thing that crossed my mind is, how difficult would it be to make
Squeak objects callable from Objective-C ? Basically, this would involve
writing, in Objective-C, a 'SqueakProxy' class which would hold a
reference to the actual Squeak object, and would forward messages to that
object as they are sent to the proxy. Only one problem: Whereas everything
is objects in Smalltalk and thus Squeak, Objective-C also caters to the
primitive C language types; which means that when parsing the call stack
frame, the runtime system has to know the types of the parameters which
are being used in the message in question. It gets this by asking the
target object (which would be our SqueakProxy) for the 'message signature'
for the message being sent, which holds information about the arguments
and the return value. 
  How would one handle a message which, in Squeak, takes an Integer ?
You'd want it to take a C 'int' on the Objective-C side, and translate
that to a Squeak Integer in the process of forwarding. But that also means
that the SqueakProxy would have to be able to extract this information -
'parameter no. 4 is an Integer, so we take in an 'int' from Objective-C' -
from the Squeak object it stands for... 
  This can obviously be 'solved' by annotating Squeak methods with type
information, but that doesn't feel like a good solution. 
  Any ideas, other than asking Apple to rewrite the compiler so that type
information is saved on the call stack as well? ;)

> One thing I am looking for is a syntax for these annotations,  
> because I know that several have already been devised and don't look  
> forward to reinventing that particular wheel.
> 
> Marcel
> 
> p.s.:  The problem is I can't find the latest version, oh well,  
> building it twice is supposed to be good anyhow...
> 
> > From: "Lawson English" <english at primenet.com>
> >
> > A tangent to that is that what would be *really* nice would be a Squeak 
> > front-end to the GNU Objective-C compiler... Best of both worlds:
> > interactive testing of algorithms within Squeak and then  
> direct-compile via
> > the Obj-C compiler. Give Java a run for its money...
> 

// Christian Brunschen





More information about the Squeak-dev mailing list