unofficial mirror of 
 help / color / mirror / Atom feed
* Guile import issue
@ 2023-06-14 20:15 Zelphir Kaltstahl
  2023-06-15  9:59 ` Unstable Horse via General Guile related discussions
  2023-06-15 10:29 ` Jean Abou Samra
  0 siblings, 2 replies; 6+ messages in thread
From: Zelphir Kaltstahl @ 2023-06-14 20:15 UTC (permalink / raw)
  To: Guile User

Hello Guile Users!

I have now created a minimal example of the import bug or issue I am observing:

(library (rectangular)
   (export real-part)

   (import (except (rnrs base) error)
           (only (guile)
                 lambda* λ))

   (define real-part
     (λ (num)
       (car num))))

(import (except (rnrs base) error)
         (only (guile)
               lambda* λ)
         (prefix (rectangular) rect:))

(define real-part
   (λ (datum)
     (rect:real-part datum)))

(real-part '(1 . 2))

$ guile --version
guile (GNU Guile) 3.0.9
Copyright (C) 2023 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later<>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ guile -L . solution.scm
In ice-9/boot-9.scm:
   1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
            5 (apply-smob/0 #<thunk 7fc30540b300>)
In ice-9/boot-9.scm:
     724:2  4 (call-with-prompt ("prompt") #<procedure 7fc30541bf80 …> …)
In ice-9/eval.scm:
     619:8  3 (_ #(#(#<directory (guile-user) 7fc30540ec80>)))
In ice-9/boot-9.scm:
    2836:4  2 (save-module-excursion #<procedure 7fc3053ff210 at ice-…>)
   4388:12  1 (_)
In unknown file:
            0 (real-part (1 . 2))

ERROR: In procedure real-part:
In procedure real-part: Wrong type argument in position 1: (1 . 2)

As you can see, Guile complains about getting a pair as argument for 
`real-part'. This is, because it still tries to use the original `real-part', 
rather than the one I imported. I am calling `real-part' by using 
`rect:real-part', so it should be even clearer, which `real-part' function it is 
supposed to use.

This feels like a bug to me. Am I overlooking something very simple, or 
misunderstanding something fundamental about modules or imports? I am really 
surprised, that I have not hit this earlier in my Guile usage. Is this perhaps 
only in 3.0.9?

Best regards,


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

end of thread, other threads:[~2023-06-15 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 20:15 Guile import issue Zelphir Kaltstahl
2023-06-15  9:59 ` Unstable Horse via General Guile related discussions
2023-06-15 12:27   ` Zelphir Kaltstahl
2023-06-15 10:29 ` Jean Abou Samra
2023-06-15 10:33   ` Jean Abou Samra
2023-06-15 12:25     ` Zelphir Kaltstahl

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