Re: sb-thread:make-thread sets thread's package to CL-USER

"Raimondas K." <[email protected]>
Newsgroups gmane.lisp.steel-bank.general
Message-ID <CAKFDN2T+Wh7A8WboD-RgBGEW6JZ4YhOU8WsHT25QyW53w5HxwQ@mail.gmail.com>
(sb-ext:symbol-global-value '*package*) both in parent thread
and new thread return #<PACKAGE "COMMON-LISP-USER">

Thank you for the pointer to the manual – I think, this explains what I am
seeing:
"threads do not inherit dynamic bindings from the parent thread"



On Wed, Jun 12, 2024 at 5:14 PM Michał "phoe" Herda via Sbcl-help <
[email protected]> wrote:

> What does (sb-ext:symbol-global-value '*package*) return in your REPL? Is
> it consistent with what https://www.sbcl.org/manual/#Special-Variables
> says?
> On 12.06.2024 22:58, Raimondas K. wrote:
>
> The *package* value in the new thread is not NIL and not what was in the
> calling thread,
> so the question whether the binding was not retained or set to an
> unexpected value
> is not as interesting as what the behaviour should be, logically.
>
>
> On Wed, Jun 12, 2024 at 4:41 PM Stas Boukarev <[email protected]> wrote:
>
>> It doesn't set anything, it just doesn't retain your binding of *pacakge*
>> at the time of calling make-thread.
>>
>> On Wed, Jun 12, 2024 at 11:37 PM Raimondas K. <[email protected]> wrote:
>>
>>> I don't see this explicitly documented either way,
>>> but it looks that, empirically, the *package* inside the
>>> newly created thread is set to COMMON-LISP-USER.
>>>
>>> To demonstrate
>>> (defpackage :my (:use :cl))
>>> (in-package :my)
>>>
>>> (defun test ()
>>>   (format *standard-output* "in TEST thread: package ~a~%" *package*))
>>>
>>> (format *standard-output* "in MAIN thread: package ~a~%" *package*)
>>>
>>> (sb-thread:make-thread #'test
>>>                          :arguments '()
>>>                          :name "test")
>>>
>>> SBCL 2.3.2 prints out
>>> in MAIN thread: package #<PACKAGE "MY">
>>> in TEST thread: package #<PACKAGE "COMMON-LISP-USER">
>>>
>>> Not sure if this is how it is supposed to work; I find this
>>> behaviour counterintuitive, c/w for instance, with (load "file").
>>>
>>>    =R.
>>>
>>>
>>> _______________________________________________
>>> Sbcl-help mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/sbcl-help
>>>
>>
>
> _______________________________________________
> Sbcl-help mailing [email protected]://lists.sourceforge.net/lists/listinfo/sbcl-help
>
> _______________________________________________
> Sbcl-help mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sbcl-help
>

_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help
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.