An implementation of the Self programming language with an actor model.
Self is a programming language designed in 1986 at Xerox PARC. It is an object-oriented programming language which uses prototype-based inheritance as its basis and message-passing as its execution method. It is dynamically (but strongly) typed.
Self uses an image-based approach for runtime. All the objects in the system are stored in a Self world and turned into a snapshot for saving. At runtime, objects can be interacted with, created and destroyed without losing state on other objects.
zigSelf takes the good parts of Self (the global object hierarchy, the image-based workflow, the visual programming, behavior sharing with parent slots, ...), and leaves the bad parts behind (the ancient UI, cooperative scheduling, ...). It also introduces an actor system inspired by Erlang to replace the cooperative scheduling of the previous version and to bring some structure to the system.
zigSelf does not use the world provided with the original Self distribution, but
instead has its own. It also has a few quality-of-life changes to the syntax
that I've found to be useful, such as the ;
operator that allows for easier
chaining of keyword messages.
Currently, zigSelf doesn't have the visual programming environment nor the snapshot system, but they are planned.
You need the Zig compiler, preferably one built with the known-good version commit. You can find the source code, instructions for building, and more on the Zig repository.
Latest Zig version known to work is 0.13.0. Earlier and later versions may work but there are no guarantees.
- Clone the repository:
git clone https://github.com/sin-ack/zigself
- Run the code:
zig build run -- examples/fibonacci.self
That's it! If you want to build a release version, you can build one with
zig build -Doptimize=ReleaseFast
and the binary will be in zig-out/bin/
.
There is an (experimental) REPL that you can run with zig build run -- repl.self
.
ZigSelf is able to run as a WebAssembly module via WASI. To build it, add the
wasm32-wasi
target when building: zig build -Dtarget=wasm32-wasi
You can then run the resulting executable at zig-out/bin/self.wasm
with
Wasmtime. Currently ZigSelf does
not support loading Self code via stdin, so you will need to give it filesystem
access like so: wasmtime --mapdir=.::. zig-out/bin/self.wasm <script name>
All contributions are welcome! Please follow the contribution guidelines for details.
zigSelf is licensed under the GNU General Public License version 3, so that the VM implementation remains open for everyone including end-users to study, modify and share. See LICENSE for more details.