) 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
Now there are classes for conditional and looping:
example:
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.
&=Basket
&+Fruit Apple &&
&+Fruit Orange &&
&+Fruit Banana &&
Look all the fruits I've got in my basket:
@forAll( @Fruit &, ;
&, - @Fruit &)
:-)
&&
Output:
| @forAll( @Fruit &, ;(lf) &, - @Fruit &) | |||||||
| @block | @separator | @block | @separator | @block | |||
|
|
|
|
| |||
| - | @Fruit | ;(lf) | - | @Fruit | ;(lf) | - | @Fruit |
IN CONTEXT: + @Fruit (1)
| IN CONTEXT: + @Fruit (2)
| IN CONTEXT: + @Fruit (3)
| |||||
| Apple | Orange | Banana | |||||
Look all the fruits I've got in my basket:
- Apple;
- Orange;
- Banana
:-)
@error: evaluating this class causes the amool compiler to fail with the error message given
in argument.
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
@method class:
&=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...
These special three classes allow you to generate the special @ and & symbols.
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.
Example:
&=@% @@ @% &&
@@% 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
>
Last compiled : Wed Apr 23 22:01:06 CEST 2003