Specifications

254
always that nice. First of all, the error messages are not always very descriptive. This is a problem the
AnyBody Modeling System shares with any other computer language compiler in the market. It is not
because programmers specifically want to bother their users. The problem is simply that error messages are
generated by a very formal semantic analysis. This makes them very different from the natural human
expression of the problem, and they can be difficult for the user to understand. But you can get used to
them and people have been known to even grow fond of their conciseness.
The second and more serious problem is that the error may occur in a totally different location from where it
really is. Let's take an example: Suppose by mistake you have included the wrong file like this:
#include "TheWrongFile.any"
somewhere in the model. When the compiler spawns to the wrong file it is likely to meet statements or
references to objects that do not exist. The compiler will report en error in WrongFile.any, but the real error
is in the file that included WrongFile.any.
Here are some typical errors and their consequences:
Forgotten
semicolon
Every statement in AnyScript must be terminated by a semicolon, and it is easy to
forget. The consequence is that the compiler will proceed to the next line and probably
report that it has encountered something unexpected there. By closer investigation,
the next line may be fully in order, and you get confused. The problem was really on
the former line.
Notice also that end braces must also have a semicolon after them.
Unbalanced
braces
Braces {} are used to group things together in AnyScript. They must be coherent and
balanced, and if you have one too few or one too many it can completely change the
structure of the code, and you can get strange error messages. The best remedy is to
use consistent indentations in the code. This makes it easy to follow the brace level
and spot mistakes.
The AnyScript editor can indent your code automatically. If you select all the text and
press Alt-F8, all lines are indented according to the brace level, and this often makes it
much easier to see where the problem is. Beware that the missing brace can be in an
include file.
Mix-up of
decimal points
and commas
Some nationalities use decimal commas, and some use decimal points. The AnyBody
Modeling System consistently uses decimal points regardless of the nationality settings
in your computer. If you type a comma in place of a decimal point, you will get a
syntax error.
Mix-up of 'O' and
'0'
Beware that there is a difference between the letter 'O' and the digit zero, '0'.
Mix-up of 'l' and
'1'
Beware that there is a difference between the letter 'l' and the digit one, '1'.
Inconsistent use
of capitals
AnyScript is case-sensitive, so these two statements refer to different variables:
MyVariable = 1;
Myvariable = 1;
This also means that predefined class names such as AnyVar or AnyFolder must be
written with correct capitalization.
Missing
reference
operator
If by mistake you assign two folders to each other:
AnyFolder MyFolderCopy = MyFolder;