Symbol
Symbols are interpreted at compile time and cannot be created dynamically. The only way to create a Symbol is by using a symbol literal, denoted by a colon () followed by an identifier. The identifier may optionally be enclosed in double quotes ("
).
For an unquoted identifier the same naming rules apply as for methods. It can contain alphanumeric characters, underscore (_
) or characters with a code point greater than 159
(0x9F
). It must not start with a number and may end with an exclamation mark () or question mark (?
).
Internally, symbols are implemented as constants with a numeric value of type Int32
.
Identifiers may contain any unicode characters. Individual symbols are separated by a single space character (
) which must be escaped to use it as a part of an identifier.