1

I used local-time's reader macro, until the moment I realized I don't need it (want to read back a date? Just use format or local-time:format-datestring and it won't output a @…).

However, it conflicts with Parenscript code using ps:@

illegal terminating character after a colon: #@

Can I disable the reader macro without restarting the image?

What it does is

(defun enable-read-macros ()
  "Enables the local-time reader macros for literal timestamps and universal time."
  (set-macro-character #\@ '%read-timestring)
  (set-dispatch-macro-character #\# #\@ '%read-universal-time)
  (values))

I don't see a reader macro on Parenscript's side.

Ehvince
  • 17,274
  • 7
  • 58
  • 79

1 Answers1

2

Maybe what you can do is to try to revert the changes to the current readtable with something like this, that should get the standard readtable and “restore” the entries of the current readtable to the standard one.

(let ((rt (copy-readtable nil)))
  (multiple-value-bind (function non-terminating-p)
      (get-macro-character #\@ rt)
    (set-macro-character #\@ function non-terminating-p))
  (set-dispatch-macro-character #\# #\@ (get-dispatch-macro-character #\# #\@ rt)))
Renzo
  • 26,848
  • 5
  • 49
  • 61
  • Very hacky and a lot to learn from here :) It doesn't work, the error remains. `get-macro-character` returns `NIL NIL`. – Ehvince Oct 28 '19 at 12:39
  • NIL is a valid designator for the standard reatable in `(set|get)-[dispatch-]macro-character`, so you do not need to use `(copy-readtable nil)` and bind it to `rt`. But apart from that, it works on my machine so maybe OP should force reload the parenscript system (e.g. (asdf:load :parenscript :force t)) – coredump Oct 28 '19 at 12:47
  • mmh `asdf:load` is undefined, tried with `load-system`, `:force` throws a compile file error, without it it runs, but it is not enough. SBCL 1.4.5, asdf 3.3.1. – Ehvince Oct 28 '19 at 12:59