unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: mikael@djurfeldt.com
Cc: guile-user <guile-user@gnu.org>
Subject: Re: export from an imported module
Date: Mon, 30 Oct 2023 15:40:17 +0100	[thread overview]
Message-ID: <CADEOaddU3Mamvy+ihafSBqWu7LYzpV2Dsx5vyXJCjcYVFuBgpg@mail.gmail.com> (raw)
In-Reply-To: <CAA2XvwKSsnzb78hgrCrFVw+gYFG3j1jiFOK01=tB9HKdkcETRA@mail.gmail.com>

thank you
it works now for the first time, i do not really know what was wrong, i just do:
rm -rf .cache/guile
and tried a re-export and it is ok.
I know the local cache but between multiple architecture with same
code shared via dropbox can cause problems

now it is ok like in Racket code, i again have a module version of
Scheme+ (no more need to includes files all is in a module now):


(define-module (Scheme+)

  #:use-module (for_next_step)
  #:use-module (growable-vector)
  ;;#:use-module (ice-9 local-eval)
  #:use-module (infix-operators)
  #:use-module (overload)
#:use-module (array)
  #:use-module (ice-9 match)
  #:use-module (ice-9 arrays) ;; for array-copy
  #:use-module (srfi srfi-1) ;; any,every
  #:use-module (srfi srfi-69) ;; Basic hash tables
  #:use-module (srfi srfi-31) ;; rec
  #:use-module (srfi srfi-26) ;; cut


#:re-export (for
           for-basic
           for-next
           for-basic/break
           for-basic/break-cont
           for/break-cont

           define-overload-procedure
           overload-procedure

           define-overload-existing-procedure
           overload-existing-procedure

           define-overload-operator
           overload-operator

           define-overload-existing-operator
           overload-existing-operator

           define-overload-n-arity-operator
           overload-n-arity-operator

           define-overload-existing-n-arity-operator
           overload-existing-n-arity-operator

           overload-function ;; see how to do the same for operator,
see the possible problem with infix precedence?


           ;;$ovrld-square-brackets-lst$

           overload-square-brackets
           ;;find-getter-and-setter-for-overloaded-square-brackets
           find-getter-for-overloaded-square-brackets
           find-setter-for-overloaded-square-brackets

           infix-operators-lst
           set-infix-operators-lst!
           replace-operator!
           )

  #:replace (do when unless)

  #:export ($nfx$
        !*prec

        def $bracket-apply$ <- ← -> → <+ ⥆ +> ⥅ declare $> $+> condx ≠
** <v v> ⇜ ⇝ repeat % << >> & $ | ) ;; <> is already defined in Guile

) ;; end module definitions

simply used like that:

(use-modules (Scheme+)
         (matrix+)
        ; (infix-operators)
        ; (overload)

         (srfi srfi-42) ; Eager Comprehensions
         (oop goops)
         (srfi srfi-43)) ; vectors

no more need to add the sub-modules of Scheme+ : infix-operators ,
overload, for_next_step in the main program ,just (use-modules
(Scheme+)) is enought.

Damien
....

On Mon, Oct 30, 2023 at 10:29 AM Mikael Djurfeldt <mikael@djurfeldt.com> wrote:
>
> Well, not sure what you mean, and if there is a problem it must be something in your code. I attach a simple example where the module (b) re-exports a definition from the used module (a).
>
> You need to have the directory re-export on your %load-path in order to be able to ,use (b) after which you should be able to type x and get 1.
>
> Best regards,
> Mikael
>
> On Mon, Oct 30, 2023 at 8:37 AM Damien Mattei <damien.mattei@gmail.com> wrote:
>>
>> i tried:
>>
>> ;;; WARNING: compilation of /usr/local/share/guile/site/3.0/Scheme+.scm failed:
>> ;;; re-exporting local variable: infix-operators-lst
>> While compiling expression:
>> re-exporting local variable: infix-operators-lst
>>
>> anyway it works with loading each module separately at different
>> levels, code is perheaps more clean to read like that instead of
>> calculating what modules should re-export above which complex things
>> and sometimes cause re-exporting the same variable from multiple
>> modules...
>>
>> On Sun, Oct 29, 2023 at 11:06 PM Mikael Djurfeldt <mikael@djurfeldt.com> wrote:
>> >
>> > #:re-export
>> >
>> > Den sön 29 okt. 2023 23:05Mikael Djurfeldt <mikael@djurfeldt.com> skrev:
>> >>
>> >> Look at #re-export here:
>> >>
>> >> https://www.gnu.org/software/guile/manual/html_node/Creating-Guile-Modules.html
>> >>
>> >> Den sön 29 okt. 2023 21:55Damien Mattei <damien.mattei@gmail.com> skrev:
>> >>>
>> >>> i noticed that in Guile if i use a module in a module i can not export
>> >>> the definitions of the used module. It is possible in Racket but in
>> >>> guile it even cause problems.
>> >>>



      reply	other threads:[~2023-10-30 14:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29 20:55 export from an imported module Damien Mattei
2023-10-29 22:05 ` Mikael Djurfeldt
2023-10-29 22:05   ` Mikael Djurfeldt
2023-10-30  7:37     ` Damien Mattei
2023-10-30  9:29       ` Mikael Djurfeldt
2023-10-30 14:40         ` Damien Mattei [this message]

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=CADEOaddU3Mamvy+ihafSBqWu7LYzpV2Dsx5vyXJCjcYVFuBgpg@mail.gmail.com \
    --to=damien.mattei@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=mikael@djurfeldt.com \
    /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).