Re: master: Make *READER-PACKAGE* be more nearly like binding *PACKAGE*

Stas Boukarev <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs,gmane.lisp.steel-bank.devel
Message-ID <CAF63=11=y+f2iwYD8XgFpzctQ2Ups6Kzbb=3hBD+-v--=pWgdw@mail.gmail.com>
::: UNEXPECTED-FAILURE :READ-IN-PACKAGE-SYNTAX due to SIMPLE-ERROR:
"The assertion
(EQ :VIOLATED!
(HANDLER-CASE (READ-FROM-STRING "cl::'foo")
(PACKAGE-LOCK-VIOLATION NIL :VIOLATED!)))
failed with
(HANDLER-CASE (READ-FROM-STRING "cl::'foo")
(PACKAGE-LOCK-VIOLATION NIL :VIOLATED!))
= 'COMMON-LISP::FOO."

On Mon, Nov 17, 2025 at 9:50 PM snuglas via Sbcl-commits
<[email protected]> wrote:
>
> The branch "master" has been updated in SBCL:
>        via  ce22877b3b6cbdb9816016c44c73e7a575ab3c4e (commit)
>       from  1a339b8f171488b492b2190e502b16924688a6c5 (commit)
>
> - Log -----------------------------------------------------------------
> commit ce22877b3b6cbdb9816016c44c73e7a575ab3c4e
> Author: Douglas Katzman <[email protected]>
> Date:   Mon Nov 17 13:07:19 2025 -0500
>
>     Make *READER-PACKAGE* be more nearly like binding *PACKAGE*
>
>     Regarding package locks, it needs to be the same as being in *PACKAGE* as far as
>     INTERN is concerned, otherwise it's not a very useful shortcut.
>     Binding *PACKAGE* could have surprising consequences, as could burying more logic
>     into PACKAGE-LOCK-VIOLATION-P. As it happens, %INTERN has a lock bypass mode.
> ---
>  src/code/reader.lisp            | 4 +++-
>  tests/package-locks.impure.lisp | 9 ++++++++-
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/code/reader.lisp b/src/code/reader.lisp
> index b72e86b1a..bda70c126 100644
> --- a/src/code/reader.lisp
> +++ b/src/code/reader.lisp
> @@ -1602,7 +1602,9 @@ extended <package-name>::<form-in-package> syntax."
>                                   (if (token-buf-only-base-chars buf)
>                                       (%readtable-symbol-preference rt)
>                                       'character)
> -                                 nil)))))))))
> +                                 ;; reader-package behaves as if *package* were that package.
> +                                 ;; Hence it should be allowed to create new symbols.
> +                                 (eq pkg *reader-package*))))))))))
>
>  ;;; For semi-external use: Return 3 values: the token-buf,
>  ;;; a flag for whether there was an escape char, and the position of
> diff --git a/tests/package-locks.impure.lisp b/tests/package-locks.impure.lisp
> index 551860e22..b71f9ce74 100644
> --- a/tests/package-locks.impure.lisp
> +++ b/tests/package-locks.impure.lisp
> @@ -677,4 +677,11 @@
>       (progv vars vals))
>     (('(test:*special*) nil) (condition 'symbol-package-locked-error))))
>
> -
> +(with-test (:name :reader-package)
> +  (lock-package (make-package "SOMEPACKAGE"))
> +  (let ((form (read-from-string "somepackage::(cl:defvar myvar 3)")))
> +    (assert (eq (symbol-package (second form)) (find-package "SOMEPACKAGE"))))
> +  ;; I don't see why deleting a package can't be done if locked. Locking should concern
> +  ;; the contents of the package, not what packages are in my system. Anyway, different problem.
> +  (unlock-package "SOMEPACKAGE")
> +  (delete-package "SOMEPACKAGE"))
>
> -----------------------------------------------------------------------
>
>
> hooks/post-receive
> --
> SBCL
>
>
> _______________________________________________
> Sbcl-commits mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sbcl-commits


_______________________________________________
Sbcl-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.