]> git.donarmstrong.com Git - lilypond.git/blob - guile18/examples/modules/main
New upstream version 2.19.65
[lilypond.git] / guile18 / examples / modules / main
1 #! /usr/local/bin/guile -s
2 !#
3 ;;; examples/modules/main -- Module system demo.
4
5 ;;; Commentary:
6
7 ;;; The main demo program for the modules subdirectory.
8 ;;;
9 ;;; This program shows how all the new fancy module import features
10 ;;; are to be used.
11
12 ;;; Author: Martin Grabmueller
13 ;;; Date: 2001-05-29
14
15 ;;; Code:
16
17 (define-module (main)
18   ;; The module 0 is imported completely.
19   ;;
20   :use-module (module-0)
21
22   ;; Module 1 is imported completely, too, but the procedure names are
23   ;; prefixed with the module name.
24   ;;
25   :use-module ((module-1) :renamer (symbol-prefix-proc 'module-1:))
26
27   ;; From module 2, only the procedure `braz' is imported, so that the
28   ;; procedures `foo' and `bar' also exported by that module don't
29   ;; clash with the definitions of module 0.
30   ;;
31   :use-module ((module-2) :select (braz))
32   
33   ;; Import the bindings from module 2 again, now renaming them by
34   ;; explicitly mentioning the original and new names.
35   ;;
36   :use-module ((module-2) :select ((braz . m-2:braz) (foo . m-2:foo))))
37
38 ;;
39 ;; Now call the various imported procedures.
40 ;;
41
42 (foo)
43 (bar)
44 (module-1:foo)
45 (module-1:bar)
46 (braz)
47 (m-2:braz)
48 (m-2:foo)
49
50 ;; Local variables:
51 ;; mode: scheme
52 ;; End: