unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#43394: DYNAMIC-LINK is unbound when using r6rs library syntax
@ 2020-09-14  3:07 Guy Gastineau
  2020-09-14  9:29 ` Linus Björnstam
  2021-05-12 21:14 ` Taylan Kammer
  0 siblings, 2 replies; 3+ messages in thread
From: Guy Gastineau @ 2020-09-14  3:07 UTC (permalink / raw)
  To: 43394

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

Guile version 3.0.4.38-64c894

I am on 64 bit arch linux, and I built guile3.0 from the AUR package
guile-git on Sep 12 2020
https://aur.archlinux.org/guile-git.git for the PKGBUILD (the config
options were practically non-existent).

I am writing to modules that dynamically link.  DYNAMIC-LINK works in the
top level REPL, and when using DEFINE-MODULE.
When using the r6rs library syntax DYNAMIC-LINK is considered unbound and
the compilation fails.
The following is an example of the behavior with a minimally viable source
for reproducing the bug.

(library (fail-link (0 1))
  (export link)
  (import)
  (define link dynamic-link))

What I get:
;;; note: source file /home/guy/guile-fail-link.scm

;;;       newer than compiled
/home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go

;;; compiling /home/guy/guile-fail-link.scm

;;; guile-fail-link.scm:4:2: warning: possibly unbound variable
`dynamic-link'
;;; compiled
/home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go

ice-9/boot-9.scm:1669:16: In procedure raise-exception:

Unbound variable: dynamic-link

What I expect:
;;; note: source file /home/guy/guile-fail-link.scm

;;;       newer than compiled
/home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go

;;; compiling /home/guy/guile-fail-link.scm

;;; compiled
/home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go

Additional information:
After I load the failing library I lose a bunch of top level definitions
and syntax.  Like IMPORT is no longer recognized and I have to `,q`
in order to get the REPL in a usable state again.

I can just use DEFINE-MODULE, but honestly I like the r6rs syntax.  Even
though imports between schemes differ enough (and FFI anyway)
that none of these libraries will end up being portable, I still like r6rs
library syntax.

If I need to find extra information for to help you all figure out what is
happening, please just let me know.

Also, thank you all for your hard work.  I am excited to have this snappy
Guile 3 on my system now ;)

- Guy Gastineau

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

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

* bug#43394: DYNAMIC-LINK is unbound when using r6rs library syntax
  2020-09-14  3:07 bug#43394: DYNAMIC-LINK is unbound when using r6rs library syntax Guy Gastineau
@ 2020-09-14  9:29 ` Linus Björnstam
  2021-05-12 21:14 ` Taylan Kammer
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Björnstam @ 2020-09-14  9:29 UTC (permalink / raw)
  To: Guy Gastineau, 43394

In r6rs libraries, only r6rs is available. You need to impor whatever bindings you need from the (guile) module

-- 
  Linus Björnstam

On Mon, 14 Sep 2020, at 05:07, Guy Gastineau wrote:
> Guile version 3.0.4.38-64c894
> 
> I am on 64 bit arch linux, and I built guile3.0 from the AUR package 
> guile-git on Sep 12 2020
> https://aur.archlinux.org/guile-git.git for the PKGBUILD (the config 
> options were practically non-existent).
> 
> I am writing to modules that dynamically link.  DYNAMIC-LINK works in 
> the top level REPL, and when using DEFINE-MODULE.
> When using the r6rs library syntax DYNAMIC-LINK is considered unbound 
> and the compilation fails.
> The following is an example of the behavior with a minimally viable 
> source for reproducing the bug.
> 
> (library (fail-link (0 1))
>   (export link)
>   (import)
>   (define link dynamic-link))
> 
> What I get:
> ;;; note: source file /home/guy/guile-fail-link.scm                     
>                                               
> ;;;       newer than compiled 
> /home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go              
> ;;; compiling /home/guy/guile-fail-link.scm                             
>                                               
> ;;; guile-fail-link.scm:4:2: warning: possibly unbound variable 
> `dynamic-link'                                        
> ;;; compiled 
> /home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go                               
> ice-9/boot-9.scm:1669:16: In procedure raise-exception:                 
>                                               
> Unbound variable: dynamic-link
> 
> What I expect:
> ;;; note: source file /home/guy/guile-fail-link.scm                     
>                                               
> ;;;       newer than compiled 
> /home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go              
> ;;; compiling /home/guy/guile-fail-link.scm                             
>                                               
> ;;; compiled 
> /home/guy/.cache/guile/ccache/3.0-LE-8-4.4/home/guy/guile-fail-link.scm.go
> 
> Additional information:
> After I load the failing library I lose a bunch of top level 
> definitions and syntax.  Like IMPORT is no longer recognized and I have 
> to `,q`
> in order to get the REPL in a usable state again.
> 
> I can just use DEFINE-MODULE, but honestly I like the r6rs syntax.  
> Even though imports between schemes differ enough (and FFI anyway)
> that none of these libraries will end up being portable, I still like 
> r6rs library syntax.
> 
> If I need to find extra information for to help you all figure out what 
> is happening, please just let me know.
> 
> Also, thank you all for your hard work.  I am excited to have this 
> snappy Guile 3 on my system now ;)
> 
> - Guy Gastineau





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

* bug#43394: DYNAMIC-LINK is unbound when using r6rs library syntax
  2020-09-14  3:07 bug#43394: DYNAMIC-LINK is unbound when using r6rs library syntax Guy Gastineau
  2020-09-14  9:29 ` Linus Björnstam
@ 2021-05-12 21:14 ` Taylan Kammer
  1 sibling, 0 replies; 3+ messages in thread
From: Taylan Kammer @ 2021-05-12 21:14 UTC (permalink / raw)
  To: 43394-done

As Linus explained, you need to import the (guile) module.

  (library (succeed-link (0 1))
    (export link)
    (import (guile))
    (define link dynamic-link))

Works as intended, so I'm closing this bug. :-)


- Taylan





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

end of thread, other threads:[~2021-05-12 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  3:07 bug#43394: DYNAMIC-LINK is unbound when using r6rs library syntax Guy Gastineau
2020-09-14  9:29 ` Linus Björnstam
2021-05-12 21:14 ` Taylan Kammer

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).