* srfi-88 keyword / symbol ambiguity
@ 2008-07-20 20:35 Julian Graham
2008-07-21 10:04 ` Ludovic Courtès
2008-07-21 12:18 ` Neil Jerram
0 siblings, 2 replies; 3+ messages in thread
From: Julian Graham @ 2008-07-20 20:35 UTC (permalink / raw
To: Guile User
[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]
Hi,
It looks like the changes to the reader to support SRFI-88-style keywords
lead to some ambiguities when it comes to whether a token is a symbol or a
keyword. Specifically, it's no longer possible to create a symbol via
quoting if that symbol ends in a colon:
guile> (use-modules (srfi srfi-88))
guile> (keyword? foo:)
#t
guile> (keyword? 'foo:)
#t
guile> (symbol->string 'foo:)
Backtrace:
In standard input:
6: 0* [symbol->string {#:foo}]
standard input:6:1: In procedure symbol->string in expression
(symbol->string (begin #)):
standard input:6:1: Wrong type argument in position 1 (expecting symbol):
#:foo
ABORT: (wrong-type-arg)
This is particularly bad because it breaks a lot of code that calls
`use-modules' with the :prefix or :rename syntax -- from looking at some of
the core libraries, it seems like it's pretty common to use rename-prefixes
that end in a colon. So, for example, the ice-9 debugger modules don't work
after loading `(srfi srfi-88)'.
I'm not sure yet what the fix would be -- maybe the reader should avoid
converting a token into a postfix-style keyword if it's obvious from the
read state that a symbol is desired (i.e., the quote character is prefixed),
but that probably doesn't cover all the possibilities.
Regards,
Julian
[-- Attachment #2: Type: text/html, Size: 1467 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: srfi-88 keyword / symbol ambiguity
2008-07-20 20:35 srfi-88 keyword / symbol ambiguity Julian Graham
@ 2008-07-21 10:04 ` Ludovic Courtès
2008-07-21 12:18 ` Neil Jerram
1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2008-07-21 10:04 UTC (permalink / raw
To: guile-user
Hi,
"Julian Graham" <joolean@gmail.com> writes:
> guile> (keyword? 'foo:)
> #t
This is expected, per SRFI-88.
> This is particularly bad because it breaks a lot of code that calls
> `use-modules' with the :prefix or :rename syntax -- from looking at some
> of the core libraries, it seems like it's pretty common to use
> rename-prefixes that end in a colon. So, for example, the ice-9 debugger
> modules don't work after loading `(srfi srfi-88)'.
Good point. Alas, that's hardly avoidable, given that the above
behavior is defined by SRFI-88.
One way to avoid it would be to not have a mutable global reader. This
can be achieved using the `current-reader' fluid and something like
Guile-Reader, which produces immutable `read' procedures:
http://www.nongnu.org/guile-reader/doc/guile-reader.html#Quick-Start
Thanks,
Ludovic.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: srfi-88 keyword / symbol ambiguity
2008-07-20 20:35 srfi-88 keyword / symbol ambiguity Julian Graham
2008-07-21 10:04 ` Ludovic Courtès
@ 2008-07-21 12:18 ` Neil Jerram
1 sibling, 0 replies; 3+ messages in thread
From: Neil Jerram @ 2008-07-21 12:18 UTC (permalink / raw
To: Julian Graham; +Cc: Guile User
2008/7/20 Julian Graham <joolean@gmail.com>:
>
> This is particularly bad because it breaks a lot of code that calls
> `use-modules' with the :prefix or :rename syntax -- from looking at some of
> the core libraries, it seems like it's pretty common to use rename-prefixes
> that end in a colon. So, for example, the ice-9 debugger modules don't work
> after loading `(srfi srfi-88)'.
If it helps you in the short term, please feel free to look at
patching those modules so that they use a prefix that doesn't end with
a colon. I think that should be compatible in API terms, because the
prefixed names are only used internally within the using module.
> I'm not sure yet what the fix would be -- maybe the reader should avoid
> converting a token into a postfix-style keyword if it's obvious from the
> read state that a symbol is desired (i.e., the quote character is prefixed),
> but that probably doesn't cover all the possibilities.
That sounds very tricky! As Ludovic said, I think read options need
somehow to be less global - whether via Guile-Reader, or otherwise.
Neil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-21 12:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-20 20:35 srfi-88 keyword / symbol ambiguity Julian Graham
2008-07-21 10:04 ` Ludovic Courtès
2008-07-21 12:18 ` Neil Jerram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).