Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: Keywords   [Contents][Index]


6.6.8.3 Keyword Read Syntax

Guile, by default, only recognizes a keyword syntax that is compatible with R5RS. A token of the form #:NAME, where NAME has the same syntax as a Scheme symbol (see Symbol Read Syntax), is the external representation of the keyword named NAME. Keyword objects print using this syntax as well, so values containing keyword objects can be read back into Guile. When used in an expression, keywords are self-quoting objects.

If the keywords read option is set to 'prefix, Guile also recognizes the alternative read syntax :NAME. Otherwise, tokens of the form :NAME are read as symbols, as required by R5RS.

If the keywords read option is set to 'postfix, Guile recognizes the SRFI-88 read syntax NAME: (see SRFI-88). Otherwise, tokens of this form are read as symbols.

To enable and disable the alternative non-R5RS keyword syntax, you use the read-set! procedure documented Scheme Read. Note that the prefix and postfix syntax are mutually exclusive.

(read-set! keywords 'prefix)

#:type
⇒
#:type

:type
⇒
#:type

(read-set! keywords 'postfix)

type:
⇒
#:type

:type
⇒
:type

(read-set! keywords #f)

#:type
⇒
#:type

:type
-|
ERROR: In expression :type:
ERROR: Unbound variable: :type
ABORT: (unbound-variable)