unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#43025: re-export-public-interface fails on Guile 3
@ 2020-08-24 16:11 Dale Smith
  2020-08-24 19:50 ` Leo Prikler
  2021-03-12 14:12 ` Dale Smith
  0 siblings, 2 replies; 8+ messages in thread
From: Dale Smith @ 2020-08-24 16:11 UTC (permalink / raw)
  To: 43025

This is actually reported by daviid on IRC.

This definition of re-export-public-interface works fine on Guile 2.x,
fails with Guile 3:
(hope this makes it through the mails cleanly)

;;;
;;; re-export-public-interface
;;;

(define-module (modules)
  #:export (re-export-public-interface))

(define-macro (re-export-public-interface . args)
  "Re-export the public interface of a module or modules. Invoked as
@code{(re-export-public-interface (mod1) (mod2)...)}."
  (if (null? args)
      '(if #f #f)
      `(begin
	 ,@(map (lambda (mod)
		  (or (list? mod)
		      (error "Invalid module specification" mod))
		  `(module-use! (module-public-interface (current-module))
				(resolve-interface ',mod)))
		args))))


;;;
;;; A module that uses the above
;;;


(define-module (a)
  #:use-module (srfi srfi-1)
  #:use-module (modules)

  #:export (map-a))


(eval-when (expand load eval)
  (re-export-public-interface (srfi srfi-1)))


(define (map-a)
  (map (lambda (item)
         (display item)
         (display " "))
    (iota 5))
  (newline)
  (values))


;;;
;;; A 3.0.4 repl session
;;;

GNU Guile 3.0.4.3-e076a5
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (add-to-load-path "/home/david/alto/projects/g-golf/3.0")
scheme@(guile-user)> ,use (a)
;;; note: source file /home/david/alto/projects/g-golf/3.0/a.scm
;;;       newer than compiled
/home/david/.cache/guile/ccache/3.0-LE-8-4.3/usr/alto/projects/g-golf/3.0/a.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/david/alto/projects/g-golf/3.0/a.scm
;;; compiled /home/david/.cache/guile/ccache/3.0-LE-8-4.3/usr/alto/projects/g-golf/3.0/a.scm.go
scheme@(guile-user)> map
WARNING: (guile-user): imported module (a) overrides core binding `map'
WARNING: (guile-user): `map' imported from both (guile) and (a)
WARNING: (guile-user): imported module (a) overrides core binding `map'
WARNING: (guile-user): `map' imported from both (guile) and (a)
;;; <unknown-location>: warning: possibly unbound variable `map'
WARNING: (guile-user): imported module (a) overrides core binding `map'
WARNING: (guile-user): `map' imported from both (guile) and (a)
WARNING: (guile-user): imported module (a) overrides core binding `map'
WARNING: (guile-user): `map' imported from both (guile) and (a)
ice-9/boot-9.scm:1670:16: In procedure raise-exception:
Unbound variable: map

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>


;;;
;;; Just to compare, a 2.2.7 session
;;; How to achieve the same using 3.0.4 is the
;;; objective ...

Press C-c C-z to bring me back.
GNU Guile 2.2.7.2-a5875-dirty
Copyright (C) 1995-2019 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (add-to-load-path "/home/david/alto/projects/g-golf/3.0")
scheme@(guile-user)> ,use (a)
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/david/alto/projects/g-golf/3.0/a.scm
;;; compiling /home/david/alto/projects/g-golf/3.0/modules.scm
;;; compiled /home/david/.cache/guile/ccache/2.2-LE-8-3.A/usr/alto/projects/g-golf/3.0/modules.scm.go
;;; compiled /home/david/.cache/guile/ccache/2.2-LE-8-3.A/usr/alto/projects/g-golf/3.0/a.scm.go
scheme@(guile-user)> map
$2 = #<procedure map (f l) | (f l1 l2) | (f l1 . rest)>





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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 16:11 bug#43025: re-export-public-interface fails on Guile 3 Dale Smith
2020-08-24 19:50 ` Leo Prikler
2020-08-26 16:51   ` Dale Smith
2020-08-26 17:06     ` Leo Prikler
2020-08-27  2:21     ` Dale Smith
2020-08-28  0:12       ` Dale Smith
2020-08-28 19:22         ` Dale Smith
2021-03-12 14:12 ` Dale Smith

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