Hello,

> ... to get only the public (exported) ones using the
> interfaces, but that is beyond my knowledge at the moment.

Here is what i do, see the attached code [which i copied from
guile-gnome], then you can use it this way, as an example:

1. you define a module b and export some ...

2.

   ;;; file a.scm STARTS here
   (define-module (a)
     :use-module (reexport)  
     :use-module (b))
     :export ... ...

   (eval-when (compile load eval)
     (re-export-public-interface (b)))

   ;; your code here...
   ;; ...
   ;;; file a.scm ENDS here

3.

   finally:

   guile
   scheme@(guile-user)> (use-modules (a))
   ;; then you can use both public interface from a and b
      

Of course this is true for any module which uses the module a [it can
refers to the public interface of b too...]

Hope this helps,
Cheers,
David

ps:     i have always tought guile itself should provide this feature as 
built-in
;; -*- mode: scheme; coding: utf-8 -*-

;;;; Copyright (C) 2011, 2012
;;;; Free Software Foundation, Inc.

;;;; This library is free software: you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License as
;;;; published by the Free Software Foundation, either version 3 of
;;;; the License, or (at your option) any later version.

;;;; This library is distributed in the hope that it will be useful, but
;;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; General Public License for more details.

;;;; You should have received a copy of the GNU General Public License
;;;; along with this library.  If not, see <http://www.gnu.org/licenses/>.
;;;;

;;; Commentary:

;; this code is the same as the one use by guile-gnome, see
;; /usr/local/share/guile-gnome-2/gnome/gw/support/modules.scm

;;; Code:

(define-module (macros reexport)
  :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-modules (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))))

Reply via email to