All types in Blue are classes and all data are objects. This general rule simplifies the language design. There are, however, a number of data types for which it is convenient to use syntax other than the Blue object call to perform one of their operations. The reason for this can be:
Another syntax is commonly used and is therefore more intuitive (e.g. 3 + 5 for integer addition, rather than 3.add (5) ).
Another syntax simplifies use of elementary constructs which should be used by beginners before the underlying language concepts need to be understood, e.g.
print ("result=", 42)
instead of
output.write ("result=".concat (42.toString))
Another syntax is more convenient (usually because it is shorter, see above).
For these reasons, several operations on the predefined classes are supported by special syntax. This special syntax is allowed in addition to the standard object-call syntax generally available for all classes, and is referred to as aliases.
The prime reason for the introduction of aliases is to make the reading and writing of simple programs performing elementary tasks easy. Aliases provide an easy, intuitive syntax for the most common operations and considerably increase the ease with which Blue can be used by beginners.
Aliases will be learnt as statements or expressions in their own right by beginners, making it unnecessary to understand all underlying concepts right from the start. The expert programmer or compiler implementor, however, will appreciate the unifying concept for all data types.
Note that aliases are a pure syntactic addition which does not add any functionality to the language. They do not affect the semantics or the theoretical language description of Blue (although they are part of the language), and are purely intended to increase readability and intuitivity of statements.
Some common aliases and their resolutions are:
alias resolution
3+6 3.add (6)
b1 or b2 b1.or (b2)
a[i] a.getElem (i)
str (num) num.toString
str (a, b, ...) a.toString.concat (b.toString.concat (...))
print (a, b) output.write ( str (a.b) )
The list of existing aliases is short and fixed - programmers cannot define additional aliases.
Where aliases exist for a construct explained in this document, they will be mentioned when that construct is introduced. A full list of aliases is given in Appendix B.