Re: keyword question
- From: Kent M Pitman <pitman@xxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 14:15:13 GMT
Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx> writes:
"TheBeaNerd" <TheBeaNerd@xxxxxxxxx> writes:
What should be the behavior of the following form:...
`(: foo)
(note the space)
We have evaluated this on 3 different lisps and
have had 3 different answers:
gcl: ( :|| foo)
ACL: (:foo)
sbcl: <illegal terminating character after a colon>
Do any standards speak to this?
Since there's no number that can be written with zero character, and
since it's possible for a symbol to have an empty string as a name, we
could choose the :xxxxx option for a symbol, and interpret : as :||.
...
Yeah, the normal rule is "tokenize symbol's boundaries first, then
parse it". So for "foo:bar" it first finds the edges and then splits
it. '(: foo) contains two potential symbol/numbers, and they have to
be analyzed separately.
Historically, this problem is because the first package system, in
Zetalisp, made colon be a special macro character that only saw the
stuff before it and then read the stuff after it with package bound.
(There was no internal/external distinction, which made it no problem
that binding package was the same as seeing internal symbols; when the
internal/external symbol distinction went in, things got hairier).
In Zetalisp, you could write foo:(a b c) and get (foo:a foo:b foo:c)
and you could write '(foo: a) and get '(foo:a). In fact, in early code
you could write #+LISPM FOO: A and have that read as FOO:A on a Lisp
Machine and as just A on a non-lisp machine.
And there was a bunch of fussing because the Lisp Machine's *features*
(in Zetalisp, not CL) had 3600 or 3670 (model numbers of Lisp Machine) on
them such that people did #+3600 and there was a question about whether
:3600 was a number (Zetalisp read this as:
#.(let ((*package* (find-package "KEYWORD"))) (read))3600
and got a number, while most implementations read it as a symbol.
I believe ANSI CL clarified that :3600 a symbol, but it's been a while
since I read it to be sure. All of the above "fun" I mention just for
color.
But ACL may be accepting (: foo) as (:foo) for Lisp Machine compatibility.
.
- References:
- keyword question
- From: TheBeaNerd
- Re: keyword question
- From: Pascal Bourguignon
- keyword question
- Prev by Date: Re: how to declare ignore for loop?
- Next by Date: Re: What language could be written "Matrix"
- Previous by thread: Re: keyword question
- Next by thread: force eof on an output stream
- Index(es):
Relevant Pages
|