Created
October 17, 2021 23:03
-
-
Save RhodiumToad/d92417aa4df36771ce993196c940a08f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-module (gentst) | |
#:use-module (oop goops) | |
#:use-module (gentst1) | |
#:use-module (gentst2) | |
#:export (test) | |
#:re-export (foo) | |
#:duplicates (merge-generics)) | |
(define (test) | |
(foo (make <gentst1>)) | |
(foo (make <gentst2>))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-module (gentst1) | |
#:use-module (oop goops) | |
#:export (<gentst1> foo)) | |
(define-class <gentst1> (<object>)) | |
(define-method (foo (self <gentst1>)) | |
(display "gentst1 foo called\n")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-module (gentst2) | |
#:use-module (oop goops) | |
#:export (<gentst2> foo)) | |
(define-class <gentst2> (<object>)) | |
(define-method (foo (self <gentst2>)) | |
(display "gentst2 foo called\n")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# force recompilation | |
akren:~ % touch gentst.scm gentst1.scm gentst2.scm | |
akren:~ % guile3 | |
GNU Guile 3.0.7 | |
scheme@(guile-user)> (add-to-load-path ".") | |
scheme@(guile-user)> ,use (gentst) | |
;;; note: source file ./gentst.scm | |
;;; newer than compiled /home/andrew/.cache/guile/ccache/3.0-LE-8-4.5/home/andrew/gentst.scm.go | |
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 | |
;;; or pass the --no-auto-compile argument to disable. | |
;;; compiling ./gentst.scm | |
;;; note: source file ./gentst1.scm | |
;;; newer than compiled /home/andrew/.cache/guile/ccache/3.0-LE-8-4.5/home/andrew/gentst1.scm.go | |
;;; compiling ./gentst1.scm | |
;;; compiled /home/andrew/.cache/guile/ccache/3.0-LE-8-4.5/home/andrew/gentst1.scm.go | |
;;; note: source file ./gentst2.scm | |
;;; newer than compiled /home/andrew/.cache/guile/ccache/3.0-LE-8-4.5/home/andrew/gentst2.scm.go | |
;;; compiling ./gentst2.scm | |
;;; compiled /home/andrew/.cache/guile/ccache/3.0-LE-8-4.5/home/andrew/gentst2.scm.go | |
WARNING: (gentst): `foo' imported from both (gentst1) and (gentst2) | |
;;; compiled /home/andrew/.cache/guile/ccache/3.0-LE-8-4.5/home/andrew/gentst.scm.go | |
scheme@(guile-user)> (test) | |
gentst1 foo called | |
gentst2 foo called | |
scheme@(guile-user)> foo | |
$1 = #<<extended-generic> foo (2)> | |
scheme@(guile-user)> | |
# try again without recompilation | |
akren:~ % guile3 | |
GNU Guile 3.0.7 | |
scheme@(guile-user)> (add-to-load-path ".") | |
scheme@(guile-user)> ,use (gentst) | |
WARNING: (gentst): `foo' imported from both (gentst1) and (gentst2) | |
scheme@(guile-user)> (test) | |
ice-9/boot-9.scm:1685:16: In procedure raise-exception: | |
No applicable method for #<<generic> foo (1)> in call (foo #<<gentst1> 805737fb0>) | |
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. | |
scheme@(guile-user) [1]> | |
scheme@(guile-user)> foo | |
$1 = #<<generic> foo (1)> | |
scheme@(guile-user)> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment