unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* define-module, #:export and export
@ 2023-01-04 15:11 yarl baudig
  2023-01-04 17:28 ` Maxime Devos
  0 siblings, 1 reply; 11+ messages in thread
From: yarl baudig @ 2023-01-04 15:11 UTC (permalink / raw)
  To: guile-devel

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!






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

end of thread, other threads:[~2023-01-13  7:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 15:11 define-module, #:export and export yarl baudig
2023-01-04 17:28 ` Maxime Devos
2023-01-05  2:07   ` Jean Abou Samra
2023-01-06 13:31     ` yarl baudig
2023-01-06 13:55       ` Maxime Devos
2023-01-07 16:24         ` Jean Abou Samra
2023-01-08  9:46           ` yarl baudig
2023-01-08 13:19             ` Jean Abou Samra
2023-01-08 15:18               ` yarl baudig
2023-01-08 15:23                 ` Jean Abou Samra
2023-01-13  7:58                   ` yarl baudig

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