Uninitialized Identifiers

Before executing a piece of code Magma attempts to check that it is semantically well formed (i.e., that it will execute without crashing). One of the checks Magma makes is to check that an identifier is declared (and thus initialized) before it is used in an expression. So, for example assuming a had not been previously declared, then before executing either of the following lines Magma will raise an error:

> a;
> b := a;
Magma can determine that execution of either line will cause an error since a has no assigned value. The user should be aware that the checks made for semantic well-formedness are necessarily not exhaustive!

There is one important rule concerning uninitialized identifiers and assignment. Consider the line,

> a := a;
Now if a had been previously declared then this is re-assignment of a. If not then it is an error since a on the right hand side of the := has no value. To catch this kind of error Magma checks the expression on the right hand side of the := for semantic well formedness before it declares the identifiers on the left hand side of the :=. Put another way the identifiers on the left hand side are not considered to be declared in the right hand side, unless they were declared previously.
V2.28, 13 July 2023