[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keywords at top level



>Date: Sun, 17 Dec 89 21:17:10 PST
>From: smh@Franz.COM (Steve Haflich)
>
>   Date: Sun, 17 Dec 89 22:50:22 -0500
>   From: eliot@phoenix.Princeton.EDU (Eliot Handelman)
>
>   A program of mine is losing because of the way franz evaluates
>   keywords at top level. The relevent code is:
>
>   (set-macro-character #\$
>       #'(lambda (stream char)
>	   (declare (ignore char))
>	   (get (read stream t nil t) 'event)))
>
>   (setf (get :one 'event) <some structure>)
>
>   ;;;And then, at top level, the following error is signalled:
>
>   <cl> $:one
>   Error: #<Event :ONE> -- invalid form for eval.
>
>This error has nothing to do with evaluation of keywords.  Lisp's
>(print (eval (read))) is trying to eval the #<Event :ONE) object
>returned by the reader.  Allegro conforms to CLtL in that arbitrary
>arrays, structures, etc. are *not* self evaluating.  The interpreter
>signals an error when you try.
>
>If you had put a quote before the form no error would have been
>signalled, i.e.:
>
><cl> '$:one

Ok, my error was due to the way KCl behaves for this kind of thing
(no error generated).

Incidentally, quoting the whole expression gives an "unknown package"
error in lucid (I haven't tried it under Franz yet) but anyhow the
reader macro can be fixed up with some quotes to do what I need.

Thanks,

--Eliot