|
|
Athena > Documentation > Overview > Athena Shell |
Athena ShellAthena Shell may be invoked in one of two different modes: interactive, batch.
Interactive mode:
Interaction is activated with the -i arguments: java -cp athena-0.1.jar athena.engine.AthenaShell -i
A prompt owl: is displayed. You may now enter any valid Smalltalk expressions. Try the following expressions:
- Object subclasses
- Object methods
- Class methods
- Class addNewClass: (Object subclass: 'MyClass' variables: '' classVariables: '')
- MyClass compileMethod: 'foo ^ 10'
- MyClass new foo
Here a screenshot of a short session:
There is no global variables in Athena. You may want to use the class Var as a shortcoming. For example, a globally accessible variable x may be defined as follows: Var varAt: 'x' put: 20 "set 20 in 'x'" (Var@'x') "get the value of 'x'"
List of variables may be retrieved with Var allVariables
Enter quit to end the session.
Batch mode:
The option -f is used to provide a file name when Athena is started. Once loaded, you can open a prompt (-i) and/or evaluate a Smalltalk expression (-e).
The syntax of SmallWorld has to be used for scripts. The scripts folder contains few examples. Assuming you have a scripts folder that contains the HelloWorld.st file, you can launch the shell with the following invocation: java -cp athena-0.1.jar athena.engine.AthenaShell -f scripts/HelloWorld.st -e "System println: FooClass new helloWorld"
Note that the syntax will probably evolve over the time.
|
|
|
|
|