[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
define-module, #:export and export
From: |
yarl baudig |
Subject: |
define-module, #:export and export |
Date: |
Wed, 4 Jan 2023 16:11:07 +0100 (CET) |
Hello guile.
I don't know if that's a bug. Anyway, I am confused about this so I ask. I came
across this problem playing with guix source code. I will share different
"tests" each test is a directory with nothing but the files I share.
each time the command to try the test (inside it's directory) is `guile
--no-auto-compile -L . main.scm`
base/
main.scm:
-----
(define-module (main)
#:export (valid-path?))
(define-syntax define-enumerate-type
(syntax-rules ()
((_ name->int (name id) ...)
(define-syntax name->int
(syntax-rules (name ...)
((_ name) id) ...)))))
(define-enumerate-type operation-id
(valid-path? 1))
(define-syntax operation
(syntax-rules ()
((operation name)
(lambda ()
(simple-format #t "~S\n" (operation-id name))
(+ 3 (operation-id name))))))
(define-syntax define-operation
(syntax-rules ()
((prout (name))
(define name (operation name)))))
(define-operation (valid-path?))
(simple-format #t "~S\n" (operation-id valid-path?))
-----
RUNS
split-base/
lib.scm:
-----
(define-module (lib)
#:export (operation-id))
(define-syntax define-enumerate-type
(syntax-rules ()
((_ name->int (name id) ...)
(define-syntax name->int
(syntax-rules (name ...)
((_ name) id) ...)))))
(define-enumerate-type operation-id
(valid-path? 1))
-----
main.scm:
-----
(define-module (main)
#:use-module (lib)
;; #:export (valid-path?))
(define-syntax operation
(syntax-rules ()
((operation name)
(lambda ()
(simple-format #t "~S\n" (operation-id name))
(+ 3 (operation-id name))))))
(define-syntax define-operation
(syntax-rules ()
((prout (name))
(define name (operation name)))))
(define-operation (valid-path?))
;; (export valid-path?)
;; (simple-format #t "~S\n" (operation-id valid-path?))
-----
Now. this RUNS. There is 3 tests from this "split-base"
split-define-module-export: from split-base, uncomment "#:export (valid-path?)"
: FAILS
Note the difference with "base", which RUNS.
split-export : from split-base (so, comment again #:export), uncomment "(export
valid-path?)" : RUNS
Here I note that there is a difference between #:export (...) and (export ...).
Is this a bug? Or an undocumented feature? Or a misunderstanding from me?
split-simple-format : from split-base, uncomment "(simple-format ...)" : FAILS.
Here the "interesting" difference is between base and split-base. I am really
confused there and I am asking for comments, please :).
Thank you!
- define-module, #:export and export,
yarl baudig <=
- Re: define-module, #:export and export, Maxime Devos, 2023/01/04
- Re: define-module, #:export and export, Jean Abou Samra, 2023/01/04
- Re: define-module, #:export and export, yarl baudig, 2023/01/06
- Re: define-module, #:export and export, Maxime Devos, 2023/01/06
- Re: define-module, #:export and export, Jean Abou Samra, 2023/01/07
- Re: define-module, #:export and export, yarl baudig, 2023/01/08
- Re: define-module, #:export and export, Jean Abou Samra, 2023/01/08
- Re: define-module, #:export and export, yarl baudig, 2023/01/08
- Re: define-module, #:export and export, Jean Abou Samra, 2023/01/08
- Re: define-module, #:export and export, yarl baudig, 2023/01/13