Re: keyword question
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 05:12:29 +0200
"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?
First note that:
http://www.lispworks.com/documentation/HyperSpec/Body/02_ad.htm
says that #\: is a constituent.
and http://www.lispworks.com/documentation/HyperSpec/Body/02_adg.htm
says that spaces are used to separate tokens.
Then, refer to:
http://www.lispworks.com/documentation/HyperSpec/Body/02_b.htm Since
#\: is a constituent, option 7 is selected and a token is read,
consisting of only that character.
Since that token contains a #\: character, we have to choose one of
the highly informal pattern specified on:
http://www.lispworks.com/documentation/HyperSpec/Body/02_ce.htm
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 :||.
Of course, the problem is that we want to allow keywords with names of
length different from 5, notably, of length inferior to 5. So if we
accept to say that :yes match the pattern :xxxxx, we could as well
accept a length of 0 and say that : match it too.
This version of ACL is definitely wrong. SBCL interpretation of the
specification is not wrong but you might prefer to choose another,
less strict, implementation...
clisp reads it as (:|| FOO) too:
[175]> '(: foo)
(:|| FOO)
[176]> (export 'cl-user::)
T
[177]> '(cl-user: foo)
(|| FOO)
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
.
- Follow-Ups:
- Re: keyword question
- From: Kent M Pitman
- Re: keyword question
- References:
- keyword question
- From: TheBeaNerd
- keyword question
- Prev by Date: force eof on an output stream
- Next by Date: Re: force eof on an output stream
- Previous by thread: keyword question
- Next by thread: Re: keyword question
- Index(es):