Download 35) p. 66. This is embarassing but I`m not sure I`ve ever understood

Transcript
87
§25.11 STRINGS
The printable characters include letters, digits, underscore, the four characters
permitted as first character of a Free_operator and other special characters such as star, \
and $. They exclude Blank, New Line, Backspace and other characters with no external
representation.
When used in expressions, the standard operators have various precedence levels,
as given in the discussion of expressions; free operators all have the same precedence,
higher than that of the standard operators.
Examples of free operators, used as function names, were given in the discussion of
features. A simple one is @, used in infix form as a synonym for item for array access: a
@ i is the i-th element of i.
The Basic Libraries contain only a small number of uses of free operators: @ for
element access in arrays and strings, # for rotation in bit sequences. Free operators are
mostly intended for developers in application areas that have a tradition of specialized
notations, such as physics and mathematics. The form of a free operator should attempt
to suggest its meaning, just as with a well chosen identifier.
The first character of a Free_operator must be one of only four possibilities, not
used by any other construct of the language. As a result, any free operator will stand out
clearly from its context, and no confusion or ambiguity is possible.
25.11 STRINGS
Definition: string
A String — a specimen of construct String — is an arbitrary sequence of characters.
A Simple_string — a specimen of Simple_string — is a String which consists of at
most one line (that is to say, has no embedded new-line character).
Do not confuse String or Simple_string with Manifest_string, seen in the discussion
of expressions. A specimen of Manifest_string, a non-terminal construct, is a Simple_
string enclosed in double quotes, as in "SOME STRING". .lW STRING". In the definition
of String, a “character” is a legal Eiffel character as defined later in this chapter. This
includes in particular:
• Any keyboard key other than %.
• Any special character described as %l for some appropriate letter l (for example %B
representing the Backspace character).
• A character given by its numerical code under the form %/code/ (for example
%/35/ for the sharp sign #, which is the character of ASCII code 35).
25.12 INTEGERS
Definition: integer
Integer, a variable lexical construct, describes unsigned integer constants in decimal
notation.
Except for underscores, no intervening characters (such as blanks) are permitted
between digits.