[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using . in module names
From: |
Taylan Ulrich Bayırlı/Kammer |
Subject: |
Re: Using . in module names |
Date: |
Fri, 03 Jun 2016 14:54:18 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Christopher Baines <address@hidden> writes:
> From reading the documentation, I would expect this to work, as . is
> valid in symbols? But from trying this out, it does not seem to (the
> module cannot be loaded).
>
> Does anyone have information about this?
While "." is valid in symbols, using it alone as a symbol is difficult,
since it's part of s-expression syntax denoting pairs.
In Guile, the syntax #{foo}# can be used to force something to be parsed
as a symbol. For instance, #{abcd}# and abcd are the same, but #{123}#
is a symbol whereas 123 is parsed as a number. Similarly, #{.}# can be
used to denote the symbol that consists of the sole character ".".
(define-module (foo #{.}# bar) ...)
(use-modules (foo #{.}# bar) ...)
By the way, R7RS has standardized the syntax |foo| to denote symbols,
which Guile already supports in a branch, though I don't know when it
will make it into a release. With that, the above examples would be
(define-module (foo |.| bar) ...)
(use-modules (foo |.| bar) ...)
which is somewhat cleaner.
There is no way to avoid using something like #{}# or || here, since in
the s-expression
(define-module (foo . bar) ...)
the "(foo . bar)" part parses as a pair object whose car is foo and cdr
is bar.
Taylan