unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "yarl baudig" <yarl-baudig@mailoo.org>
To: guile-devel@gnu.org
Subject: define-module, #:export and export
Date: Wed,  4 Jan 2023 16:11:07 +0100 (CET)	[thread overview]
Message-ID: <ea-mime-63b5970b-11a2-2bdbe28d@www.mailo.com> (raw)

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!






             reply	other threads:[~2023-01-04 15:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 15:11 yarl baudig [this message]
2023-01-04 17:28 ` define-module, #:export and export 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea-mime-63b5970b-11a2-2bdbe28d@www.mailo.com \
    --to=yarl-baudig@mailoo.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).