next up previous contents
Next: Arrays Up: Literals Previous: Strings   Contents

Symbols

Symbols start with the pound sign character (#) and consist of all following characters up to the next non-escaped whitespace, unless the pound sign is followed exactly by a string literal, in which case the string's contents become the identifier for the symbol. So, for example, the following are all valid symbols and symbol literals:

#$

#key:word:expression:

#something_with_underscores

#'A full string with a \nnewline in it.'

#'@' "@ and other reserved characters must be escaped to deal with their lexical characteristics."

A property of Symbols and their literals is that any literal with the same value as another also refers to the same instance as any other symbol literal with that value in a Slate system. This allows fast hashes and comparisons by identity rather than value hashes. In particular, as with Slate identifiers, a Symbol's value is case-sensitive, so #a and #A are distinct.

Internally, Slate currently keeps one global table for symbols, and uses individual context objects to hold local bindings.4



Brian Rice 2004-08-24