) Built in classes (
There are some classes that are hardcoded inside the Amool system.
All direct children of these classes are visible from everywhere; when you search for
a child, the system first looks at @amool, then at the current context, then in
@external, and finally in @internal
- This is the "king" class, that is super class of everybody, that is parent of
everybody, that is visible from everywhere, ... :-). It has actually no other use than
being parent of all classes... it's just that I needed one :-).
- This is another "container" class; there is no point in executing it. It's just a class that contains all internal classes,
ie classes that do some processing. I'll explain them some time later. (This class is a direct child of @amool)
- Yet another (the last one I promise) container class. The children of this class reflect the hard disk directory structure.
It is currently (I'll change that a little, but nothing serious) based at the current directory, unless specified otherwise in the configuration file.
So when you write @external.bong.foo, Amool will look for a file named ./bong/foo ... Note that you cannot access a file or directory
that has a dot or a space in its name (this might change in the future) !
Children of @amool.internal
These classes allow you to do some logic operation. For Amool, 0 (zero) and false (no case) are considered as false
And what is not false, ie all the rest, is true. Operators returning a boolean value will return true or false
- @or( a &, b &)
- true when either of the two arguments are true
- @and( a &, b &)
- true when both arguments are true
- @not( a &)
- true when the argument is false
- @equals( a &, b &)
- true when the two arguments evaluate to the same sequence. You can use @equals( @whatever &) to know if @whatever evaluates to the empty string (because, as the second argument of @equals is missing, it will be set to the empty string)
Now there are classes for conditional and looping:
- @if( c &, t &, f &)
This does first internally evaluate (ie, without output) the first argument c (like "condition");
Then if it is evaluated to true, then the term t is evaluated
otherwise, the term f is evaluated.
The weather is @weather ; I will take my @if( @equals( @weather &, rainy &) &, umbrella. &, sunglasses. &)
If @weather is rainy, then this will return:
The weather is rainy ; I will take my umbrella.
If @weather is sunny, then this will be returned:
The weather is sunny ; I will take my sunglasses.
- @forAll( source &, separator &, block &)
This is currently the only way for accessing multiple values of a symbol; It evaluates the block
sequence for each value of the class described by source. You can access the current value using it's
name. (This class creates a subclass of the current class setting that symbol).
Each block is separated by an execution of separator. (the second argument)
A little example:
&+Fruit Apple &&
&+Fruit Orange &&
&+Fruit Banana &&
Look all the fruits I've got in my basket:
@forAll( @Fruit &, ;
&, - @Fruit &)
|@forAll( @Fruit &,
;(lf) &, - @Fruit &)
||IN CONTEXT: + @Fruit (1)|
||IN CONTEXT: + @Fruit (2)|
||IN CONTEXT: + @Fruit (3)|
Look all the fruits I've got in my basket:
@error: evaluating this class causes the amool compiler to fail with the error message given
If you wonder of what use this might be : you can define children you want your subclass to override, for
instance the @name field for a method must be implemented, so you would write, in the generic
&=name @error( you must give a name to your method! &) &&
So if you forget to override this when actually making a method, you will get that message...
Last Minute Classes
These special three classes allow you to generate the special @ and & symbols.
- This class outputs the At (@) character.
- This class outputs the Ampersand (&) character.
- This class is a bit special, in the sense that it removes the character on its left
and the character on its right. It is mainly useful for concatenating the results of two classes,
with something like @Hello @% @World
As the "last minute" expressions states, these three classes are evaluated at the latest possible time.
It means that while the decoding process is taking place, they just stay as they are, and when over,
they are evaluated.
This means that you can generate things that look like class names but that won't be evaluated:
@@ @% This_Is_Not_A_Class_Call would output @This_Is_Not_A_Class_Call.
When you write @% at the beginning of a class definition, it also means that, when calling that class,
it will first write @% at its beginning, and then remove the space or whatever is coming before.
&=@% @@ @% &&
@@% Zoo is still not a class name
This would output:
@Zoo is still not a class name
This is because calling @@% really writes @@ @%, so the second line generates
@@ @% Zoo is still not a class name, which is then ready to be output
Maxime Gamboni <>
Last compiled : Wed Apr 23 22:01:06 CEST 2003