We follow tradition and introduce Acton with the following minimal example
# This is a comment, which is ignored by the compiler.
# This is the main actor, which we will tell the compiler to use as the root
# actor by setting `--root main` when compiling the program
Compile and run:
An executing Acton program consists of a collection of interacting actors. Here we have just a single actor, which has been given the name
main and that acts as the root actor of our system. The root actor of a system takes a parameter
env, which represents the execution environment.
env has methods for accessing command line arguments and carries a reference to the capabilities of the surrounding world,
WorldCap, for accessing the environment, e.g. reading from and writing to keyboard/screen and files, working with sockets etc. When the program is executed, the run time system creates the root actor, hands it the
env and runs its initialization code, which here is just a single command, to print a message on screen.
The careful reader may ask why
env. The answer is that we see
env parameter to all sub-units.