diff --git a/doc/best_practices.md b/doc/best_practices.md index e22a9bac4f99258520d67e4164bff4064b873d49..62a97293aba429807d7e4e11d0bfe892a80cb09d 100644 --- a/doc/best_practices.md +++ b/doc/best_practices.md @@ -823,3 +823,14 @@ operations on a given component, you MAY want to override or wrap around the `component-if-feature` method for that component instead of defining all those `perform`, `output-files` and `input-files` methods. +## Other + +Do not side-effect the current `*readtable*`, +which is never guaranteed to be writable, and +may not be what is current when you need the modification. +If you need modifications to the readtable, use `named-readtables`, +`reader-interception`, or some other adequate mechanism. +To bind the readtable, use `named-readtables:in-readtable` or `cl-syntax:in-syntax` +in each file that needs a non-standard readtable, and/or use an `:around-compile` hook +to automatically bind it around every file in a module or system. + diff --git a/uiop/lisp-build.lisp b/uiop/lisp-build.lisp index a4df99eb9760af819c8b36aded840b670901e91b..254301cea8f5c9b8340d188c1836a54620ba36d1 100644 --- a/uiop/lisp-build.lisp +++ b/uiop/lisp-build.lisp @@ -497,7 +497,8 @@ possibly in a different process." :element-type *default-stream-element-type* :external-format *utf-8-external-format*) (with-safe-io-syntax () - (write (reify-deferred-warnings) :stream s :pretty t :readably t) + (let ((*read-eval* t)) + (write (reify-deferred-warnings) :stream s :pretty t :readably t)) (terpri s)))) (defun warnings-file-type (&optional implementation-type) @@ -545,7 +546,10 @@ re-intern and raise any warnings that are still meaningful." (reset-deferred-warnings) (dolist (file files) (unreify-deferred-warnings - (handler-case (safe-read-file-form file) + (handler-case + (with-safe-io-syntax () + (let ((*read-eval* t)) + (read-file-form file))) (error (c) ;;(delete-file-if-exists file) ;; deleting forces rebuild but prevents debugging (push c file-errors)