A little heads up for anyone not watching svn:
I've just committed the initial version of the Smalltalk compiler I've
been working on for the last few weeks. It uses the same code as
clang (the C/C++/ObjC front end to LLVM) for generating code related
to the object model, and some new code for Smalltalk-specific things.
It's still very much a work in progress, however it is now in a state
where it can start to be useful. I am currently running a small test
program[1], which creates a new class in Smalltalk. This is then
instantiated in Objective-C and sent a message. The argument is an
Objective-C object which has its run: method called with a block.
This object then calls -value on the block to get the result. This
shows that we can implement things like -map: on NSArray, in Objective-
C, taking a block as an argument and have it Just Work (although
calling it from Objective-C will be a bit tricky).
Small integers are implemented in the traditional Smalltalk way, by
storing their values in pointers and the least significant bit being
set to one. Currently, there is no auto-boxing / unboxing for
primitives passed in or to Objective-C, although this will be
relatively easy to add.
This is not a bridge, it's a native implementation - Smalltalk methods
are compiled to native code and Smalltalk objects are Objective-C
objects (with the exception of SmallInts).
David
[1] This code (-log is a category on NSObject which passes self to
NSLog):
NSObject subclass: TestObject
[
addObject: r
[ | a b c|
r log.
b := 12.
c := b + 5.
b stringValue log.
b := NSValue valueWithPointer:c.
'Wibble?' log.
self wibble:c.
b log.
a := NSMutableArray array.
a log.
r run:[ a log. ].
]
wibble: a
[
'wibble called' log.
a log.
^a.
]
]
_______________________________________________
Etoile-dev mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-dev