unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#68673: can't export conditional variable set with 'cond')
       [not found] <CAOcxjM7hLZP7jhp+vHy9f+8Yo+UDS5chHyi5q-5OaEFCttxMtQ@mail.gmail.com>
@ 2024-01-23 14:19 ` M
  2024-01-23 14:23 ` bug#68673: FW: can't export conditional variable set with 'cond' M
  1 sibling, 0 replies; 2+ messages in thread
From: M @ 2024-01-23 14:19 UTC (permalink / raw)
  To: mbcladwell, 68673

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

>Why can I reset the variables with both 'cond' and 'if' in >env.scm, but
>only the variable reset with 'if' is exported with the updated >value?

Because apparently that’s a bug in Guile, presumably in the implementation of inlining. I propose sending the mail to bug-guile@gnu.org.


[-- Attachment #2: Type: text/html, Size: 1553 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#68673: FW: can't export conditional variable set with 'cond'
       [not found] <CAOcxjM7hLZP7jhp+vHy9f+8Yo+UDS5chHyi5q-5OaEFCttxMtQ@mail.gmail.com>
  2024-01-23 14:19 ` bug#68673: can't export conditional variable set with 'cond') M
@ 2024-01-23 14:23 ` M
  1 sibling, 0 replies; 2+ messages in thread
From: M @ 2024-01-23 14:23 UTC (permalink / raw)
  To: 68673@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]

Let’s include a copy of the actual bug report:


Hi,

Suppose I have the following module "testexport" with the auxiliary module
"env.scm", used to set global environment variables:

-------------testexport.scm begin----------------------------------
(define-module (testexport)
  #:use-module (ice-9 pretty-print)
  #:use-module (env)
  )

(define (main)
  (pretty-print (string-append  "varA in main: " varA))
  (pretty-print (string-append  "varB in main: " varB))
  (pretty-print (string-append  "varC in main: " varC))
  )

(main)
-------------testexport.scm end----------------------------------

-------------env.scm begin----------------------------------
(define-module (env)
  #:use-module (ice-9 pretty-print)
  #:export(varA varB varC))

(define varA "A")
(define varB "")
(define varC "")
(define testval "x")

(cond
 ((string= testval "x") (set! varB "B"))
 ((string= testval "y") (set! varB "error"))
 ((string= testval "z") (set! varB "null"))
 )
(pretty-print (string-append "varB post cond: " varB))

(if (string= testval "x")  (set! varC "C"))
(pretty-print (string-append "varC post if: " varC))
-------------env.scm end----------------------------------

When I run the above I get as output:

"varB post cond: B"
"varC post if: C"
"varA in main: A"
"varB in main: "
"varC in main: C"

Why can I reset the variables with both 'cond' and 'if' in env.scm, but
only the variable reset with 'if' is exported with the updated value?
Thanks
Mortimer


[-- Attachment #2: Type: text/html, Size: 4356 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-23 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAOcxjM7hLZP7jhp+vHy9f+8Yo+UDS5chHyi5q-5OaEFCttxMtQ@mail.gmail.com>
2024-01-23 14:19 ` bug#68673: can't export conditional variable set with 'cond') M
2024-01-23 14:23 ` bug#68673: FW: can't export conditional variable set with 'cond' M

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).