Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Disabling colon in readtable?

31 views
Skip to first unread message

John R. Bob Bane

unread,
Jun 4, 1996, 3:00:00 AM6/4/96
to

Is there any way to disable the package-delimiter function of the colon
in a Common Lisp readtable? The following fails in Allegro 4.2:

(defvar *hack* (copy-readtable nil))

(defun test-hack nil
(let ((*readtable* *hack*))
(declare (special *readtable*))
(read-from-string "foo:bar")))

;;
;; Doing these has no effect; (test-hack) still breaks
;;
(set-syntax-from-char #\: #\a *hack* *hack*)
(set-macro-character #\: (get-macro-character #\a *hack*) t *hack*)

Am I missing something, or is there something strange about Allegro CL?
At the moment, I would even accept a non-portable solution that worked.

- Bob Bane
--
Internet: ba...@tove.cs.umd.edu
Voice: 301-552-4860

Erik Naggum

unread,
Jun 5, 1996, 3:00:00 AM6/5/96
to

[John R. "Bob" Bane]

| Is there any way to disable the package-delimiter function of the colon
| in a Common Lisp readtable?

when I went looking for this some months ago, I looked at the internals in
CMUCL and found a work-around. this is most probably completely local to
CMUCL, but it may indicate that there is hope, if nothing else:

(set-syntax-from-char #\: #\a *readtable* *readtable*)
(common-lisp::set-secondary-attribute #\:
(common-lisp::get-secondary-attribute #\a))

now,

(read-from-string "foo:bar")
=> |FOO:BAR|

I never bothered to look for the magic in the symbol printer, but it seems
that some similar internal table hackery is needed. pity they aren't just
a little bit more programmer-friendly.

| Am I missing something, or is there something strange about Allegro CL?

once a symbol is started by a constituent, the package-delimiter is part of
the internal makeup of a symbol. like numbers, these are not read by user
code or macro characters, but by the reader itself. unfortunately, this is
the one part of the reader that is not user configurable, either. bummer.

--
sometimes a .sig is just a .sig

0 new messages