Glad to hear it. I hate the attitude that the only way to make progress is to break all code in existence. It's a lame and lazy attitude, unworthy of engineers who understand what they're doing.
It always depends on how fast you want to make progress and if you want to carry existing code with you/move it over to something new, correct? ;)
To me two main questions remain: 1. why is it still hard to interface with the outside world from Squeak (is it a problem of current FFI implementation, the lack of callbacks, lack of pinned objects, ...) I doubt that it is a problem of Syntax, although I liked the way it was done in Smalltalk/MT and Smallscript:
Example ST/MT:
WINAPI MessageBox: NULL with: result asString with: 'Can you do this in another language' with: MB_YESNO | MB_ICONHAND
Callback methods are in special method categories.
Example Smallscript/S#: User32::MessageBox(NULL,'Hello','World',0)
2. how easy could a FFI (referring to a general framework - not the current implementation we have) be made so that people could easily interface with external stuff
Especially if there is an answer to the second question one can think about making it compatible with existing stuff...
I've used FFI a few times (for instance to bind libharu for PDF generation, see HPDF on squeaksource) and the current syntax was no problem. But the lack of callbacks and others ... holds us back to provide good bindings to C/C++, COM, Java, ...
Bye T.
On 25.03.2011, at 12:06, Torsten Bergmann wrote:
- why is it still hard to interface with the outside world from Squeak (is it a problem of current FFI implementation, the lack of callbacks, lack of pinned objects, ...) I doubt that it is a problem of Syntax, although I liked the way it was done in Smalltalk/MT and Smallscript:
IMHO it's just lack of interest. One of the reasons people choose Squeak is its "cross-platform-ness", so adding specific platform support rarely gets larger traction. But projects like Mars show it's possible, you just really need to want it :)
Example ST/MT:
WINAPI MessageBox: NULL with: result asString with: 'Can you do this in another language' with: MB_YESNO | MB_ICONHAND
Callback methods are in special method categories.
Example Smallscript/S#: User32::MessageBox(NULL,'Hello','World',0)
This has not much to do with FFI syntax itself. But *someone* created those classes. In Squeak, you would just need to create a "WINAPI" or "User32" class that provides all the functions.
That's how the OpenGL bindings work in Croquet, for example. As a user you just call the OpenGL functions, someone else took care of providing the FFI calls.
- Bert -
On 25 March 2011 12:28, Bert Freudenberg bert@freudenbergs.de wrote:
On 25.03.2011, at 12:06, Torsten Bergmann wrote:
- why is it still hard to interface with the outside world
from Squeak (is it a problem of current FFI implementation, the lack of callbacks, lack of pinned objects, ...) I doubt that it is a problem of Syntax, although I liked the way it was done in Smalltalk/MT and Smallscript:
IMHO it's just lack of interest. One of the reasons people choose Squeak is its "cross-platform-ness", so adding specific platform support rarely gets larger traction. But projects like Mars show it's possible, you just really need to want it :)
Example ST/MT:
WINAPI MessageBox: NULL with: result asString with: 'Can you do this in another language' with: MB_YESNO | MB_ICONHAND
Callback methods are in special method categories.
Example Smallscript/S#: User32::MessageBox(NULL,'Hello','World',0)
This has not much to do with FFI syntax itself. But *someone* created those classes. In Squeak, you would just need to create a "WINAPI" or "User32" class that provides all the functions.
That's how the OpenGL bindings work in Croquet, for example. As a user you just call the OpenGL functions, someone else took care of providing the FFI calls.
yep. lets not mix ffi annotation syntax with stuff which uses it, which is completely up to developer :)
- Bert -
vm-dev@lists.squeakfoundation.org