unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* export from an imported module
@ 2023-10-29 20:55 Damien Mattei
  2023-10-29 22:05 ` Mikael Djurfeldt
  0 siblings, 1 reply; 6+ messages in thread
From: Damien Mattei @ 2023-10-29 20:55 UTC (permalink / raw)
  To: guile-user

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.



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

* Re: export from an imported module
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Djurfeldt @ 2023-10-29 22:05 UTC (permalink / raw)
  To: Damien Mattei; +Cc: guile-user, Mikael Djurfeldt

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


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

* Re: export from an imported module
  2023-10-29 22:05 ` Mikael Djurfeldt
@ 2023-10-29 22:05   ` Mikael Djurfeldt
  2023-10-30  7:37     ` Damien Mattei
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Djurfeldt @ 2023-10-29 22:05 UTC (permalink / raw)
  To: Damien Mattei; +Cc: guile-user

#: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.
>>
>>


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

* Re: export from an imported module
  2023-10-29 22:05   ` Mikael Djurfeldt
@ 2023-10-30  7:37     ` Damien Mattei
  2023-10-30  9:29       ` Mikael Djurfeldt
  0 siblings, 1 reply; 6+ messages in thread
From: Damien Mattei @ 2023-10-30  7:37 UTC (permalink / raw)
  To: mikael; +Cc: guile-user

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



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

* Re: export from an imported module
  2023-10-30  7:37     ` Damien Mattei
@ 2023-10-30  9:29       ` Mikael Djurfeldt
  2023-10-30 14:40         ` Damien Mattei
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Djurfeldt @ 2023-10-30  9:29 UTC (permalink / raw)
  To: Damien Mattei; +Cc: guile-user, Mikael Djurfeldt

[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]

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

[-- Attachment #2: re-export.tar.gz --]
[-- Type: application/gzip, Size: 227 bytes --]

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

* Re: export from an imported module
  2023-10-30  9:29       ` Mikael Djurfeldt
@ 2023-10-30 14:40         ` Damien Mattei
  0 siblings, 0 replies; 6+ messages in thread
From: Damien Mattei @ 2023-10-30 14:40 UTC (permalink / raw)
  To: mikael; +Cc: guile-user

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



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

end of thread, other threads:[~2023-10-30 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).