(resending with a proper subject line)
On 01.10.2010, at 09:50, Torsten Bergmann wrote:
> Anything I can say on this topic is that it works well
> to move more and more stuff moved from the VM to the image
> and once you are used to it you will see that writing
> external DLL's/plugins is cumbersome and only required
> I agree with others here: we have the power and tools in Smalltalk
> and should move more and more stuff to the image.
> Make it run, make it right and then make it fast (and only in the
> worst case with a custom plugin written in C).
We are not talking about optional add-ons. For that, yes, FFI is the quick-and-dirty solution, go ahead and have fun wrapping every library on the planet.
What I am objecting to is the zealous quest to move core functionality out of proper plugins to the image, be it using FFI or Alien or any other generic callout mechanism.
Being able to take an image and run it anywhere without having to worry about the platform is a Good Thing. Once John ported the Squeak VM to iOS, Etoys *just worked*. That's the power our VM abstraction gives us.
Also, the whole Squeak sandbox security model depends on the VM being able to prevent code in the image to do damage. There is no way to do that if you let the image use FFI. Do you want my Etoys project to wipe out your hard disk? I didn't think so.
There is another benefit to plugins that encapsulate platform capabilities: Once the interface has been written, you only need to know C, not so much Smalltalk, to port it to another platform. If the primitive interface has been well-designed this is much easier than doing it in Smalltalk. Plus, it is much simpler to get help from platform experts if they can see the C code.
- Bert -