bug#73334: [critical bug] The set! doesn't work in indirect reference

2024-09-18 Thread Nala Ginrut
Thanks for the reply!
I've taken a look at
https://www.gnu.org/software/guile/manual/html_node/Declarative-Modules.html
It's related to #:declarative?

Thanks again!
Best regards.


On Wed, Sep 18, 2024 at 11:50 PM Thompson, David 
wrote:

> On Wed, Sep 18, 2024 at 10:38 AM Nala Ginrut  wrote:
> >
> > The result is:
> > ;;; (before #f)
> > ;;; (after #f)
> >
> > The expected result should be:
> > ;; (before #f)
> > ;; (after 123)
>
> I don't think this is a bug. Both modules are declarative (the
> default). 'global' from module (aaa) is presumably being inlined into
> the 'pk' calls in module (bbb).  If you mark module (bbb) as
> '#:declarative? #f' then you get your expected result.
>
> Hope this helps,
>
> - Dave
>


bug#73334: [critical bug] The set! doesn't work in indirect reference

2024-09-18 Thread Nala Ginrut
Hi folks!
Recently I was bothered by a strange bug when debugging Artanis, here's how
to reproduce.
You need three files, say aaa.scm, bbb.scm, and entry

-aaa.scm
(define-module (aaa)
 #:export (global))

(define global #f)
--aaa.scm end

--bbb.scm
(define-module (bbb)
 #:use-module (aaa)
 #:export (fun))

(define (fun)
 (pk 'before global)
 (set! global 123)
 (pk 'after global))
---bbb.scm end-



--entry-
(import (bbb))

(fun)
-entry end-


Put all files in the same directory, and run:
cut
guile -L . entry
end---


The result is:
;;; (before #f)
;;; (after #f)

The expected result should be:
;; (before #f)
;; (after 123)

--

This was tested in 3.0.9 and 3.0.10.

I also CC  guile-user list, in case anyone was troubled by strange bugs,
this may be a hint.


Best regards.


bug#73334: [critical bug] The set! doesn't work in indirect reference

2024-09-18 Thread Thompson, David
On Wed, Sep 18, 2024 at 10:38 AM Nala Ginrut  wrote:
>
> The result is:
> ;;; (before #f)
> ;;; (after #f)
>
> The expected result should be:
> ;; (before #f)
> ;; (after 123)

I don't think this is a bug. Both modules are declarative (the
default). 'global' from module (aaa) is presumably being inlined into
the 'pk' calls in module (bbb).  If you mark module (bbb) as
'#:declarative? #f' then you get your expected result.

Hope this helps,

- Dave