Opened 4 years ago

Last modified 4 years ago

#1308 new defect

copy-readtable WITH dispatch macros?

Reported by: pingbak Owned by:
Priority: normal Milestone:
Component: other Version: trunk
Keywords: Cc:

Description

net.didierverna.clon (command line options nuker) fails to load because "#_" is missing from the copied read table.

What's the proper way to copy the read table *with* all of the dispatch macros?

Change History (3)

comment:1 follow-up: Changed 4 years ago by gb

What is the "from readtable" argument that COPY-READTABLE is being called with in your case?

comment:2 in reply to: ↑ 1 ; follow-up: Changed 4 years ago by pingbak

Replying to gb:

What is the "from readtable" argument that COPY-READTABLE is being called with in your case?

The code simply calls (copy-readtable):

(defvar *readtable* (copy-readtable)
  "The Clon readtable.")

(BTW: Not my code -- it's a package distributed via quicklisp. I'm attempting to get the Sphinx documentation generator with the CL parser contrib working. It depends on the Command Line Option Nuker.)

comment:3 in reply to: ↑ 2 Changed 4 years ago by gb

Replying to pingbak:

Replying to gb:

What is the "from readtable" argument that COPY-READTABLE is being called with in your case?

The code simply calls (copy-readtable):

(defvar *readtable* (copy-readtable)
  "The Clon readtable.")

(BTW: Not my code -- it's a package distributed via quicklisp. I'm attempting to get the Sphinx documentation generator with the CL parser contrib working. It depends on the Command Line Option Nuker.)

? (get-dispatch-macro-character #\# #\_)
#<Compiled-function |#_-reader| (Non-Global)  #x300000BC6FCF>
? (get-dispatch-macro-character #\# #\_ (copy-readtable))
#<Compiled-function |#_-reader| (Non-Global)  #x300000BC6FCF>

Whatever problem you're having. it doesn't seem to be a case of COPY-READTABLE not copying dispatch macros.

Note that not all readtables contain implementation-specific dispatch-macro definitions

? (get-dispatch-macro-character #\# #\_ (copy-readtable nil))
NIL

WITH-STANDARD-IO-SYNTAX (for instance) binds CL:*READTABLE* to a a readtable that only contains standard dispatch-macro definitions.

As far as I can tell, COPY-READTABLE works correctly and the returned readtable contains all dispatch macros (and other things) that are defined in its "from-readtable" arg. if you expect to see #_ defined in the copy, please check to ensure that it was defined in that "from-readtable" arg.

Note: See TracTickets for help on using tickets.