Literals
Factor handbook » The language » Syntax

Prev:Top level forms
Next:Parse time evaluation


Many different types of objects can be constructed at parse time via literal syntax. Numbers are a special case since support for reading them is built-in to the parser. All other literals are constructed via parsing words.

If a quotation contains a literal object, the same literal object instance is used each time the quotation executes; that is, literals are "live".

Using mutable object literals in word definitions requires care, since if those objects are mutated, the actual word definition will be changed, which is in most cases not what you would expect. Literals should be cloned before being passed to a word which may potentially mutate them.
Number syntax
Word syntax
Quotation syntax
Array syntax
Character and string syntax
Byte array syntax
Vector syntax
String buffer syntax
Hashtable syntax
Hash set syntax
Tuple syntax
Pathname syntax
Stack effect syntax