If you read this blog (and have the patience to follow me at Twitter😉, you already know I was busy working on my AjTalk Smalltalk-like VM written in C#:
There is a small Hello, World:
nil subclass:#Object instanceVariableNames:'' classVariableNames:'' poolDictionaries:'' category:'Kernel-Objects' ! Object subclass:#Program instanceVariableNames:'' classVariableNames:'' poolDictionaries:'' category:'Kernel-Objects' ! !Program class methods! main @System.Console writeLine: 'Hello, world'! !
It coud be smaller, but the Program main is the entry point of a saved image. The console program can generate an image using
ajtalk Programas/HelloWorld.st –s hello.im
and then, launch the image with
In this case, AjTalk looks for a global Program with a method main, and if it exists, it will be invoked.
The @ notation for @System.Console is the way to refer to a native .NET type.
Note that I don’t load all the class library, only the classes that I need for run the image. AjTalk can manage many Smalltalk machines in memory, each one with its own classes and methods. I have implemented a way of manipulating one machine from another, so you don’t need, in principle, to have a complete environment in machine A. So, I can produce minimal image, if I remove the classes and methods I don’t use. Instead of having a big image in memory, and cut the fat, my running machines born light by design. This is an example of “thinking out of the box”: for decades, Smalltalk developers thought on having only one image, and were struggling on how to make it an smaller one. My approach is totally different: make the VM so it can manage many machine/images in memory, so one can be manipulated from another one.
Angel “Java” Lopez