expression ==> bool_literal_expression | char_literal_expression | str_literal_expression | int_literal_expression | flt_literal_expression
There are special lexical forms for literal expressions which define boolean, character, string, integer, and floating point values. These literal forms all have a concrete type derived from the syntax; typing of literals is not dependent on context. Sather does not do implicit type coercions (such as promoting an integer to floating point when used in a floating point context.) Types must instead be promoted explicitly by the programmer. This avoids a number of portability and precision issues (for example, when an integer can't be represented by the floating point representation.)
Example 6-1. These two expressions are equivalent. In the first, the 'd' is a literal suffix denoting the type. In the second, '3.14' is the literal and '.fltd' is an explicit conversion.
3.14d -- A double precision literal 3.14.fltd -- Single, but converted
Example 6-2. Examples:
bool_literal_expression ==> true | false
BOOL objects represent boolean values (See Type). The two possible values are represented by the boolean literal expressions: 'true' and 'false'.