* inserting a file in a module?
@ 2023-10-05 6:39 Damien Mattei
2023-10-05 7:34 ` tomas
0 siblings, 1 reply; 5+ messages in thread
From: Damien Mattei @ 2023-10-05 6:39 UTC (permalink / raw)
To: guile-user
hello,
i have problem i do not understand when inserting a file in a module,
things i never done before:
(define-module (matrix)
#:use-module (oop goops)
#:use-module ((guile)
#:select (*)
#:prefix orig:)
#:export (<matrix>
matrix
matrix-v)
)
(define scheme-plus-path "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile")
(include (string-append scheme-plus-path "/Scheme+.scm"))
...
i get this error:
scheme@(guile-user)> (use-modules (matrix))
;;; note: source file /usr/local/share/guile/site/3.0/matrix.scm
;;; newer than compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/matrix.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /usr/local/share/guile/site/3.0/matrix.scm
;;; WARNING: compilation of /usr/local/share/guile/site/3.0/matrix.scm failed:
;;; In procedure string-prefix?: Wrong type argument in position 2
(expecting string): (string-append scheme-plus-path "/Scheme+.scm")
While compiling expression:
In procedure string-prefix?: Wrong type argument in position 2
(expecting string): (string-append scheme-plus-path "/Scheme+.scm")
but it works if i replace the string-append by the string already appended :
(include "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile/Scheme+.scm")
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: inserting a file in a module?
2023-10-05 6:39 inserting a file in a module? Damien Mattei
@ 2023-10-05 7:34 ` tomas
2023-10-05 9:12 ` Damien Mattei
2023-10-06 7:14 ` Damien Mattei
0 siblings, 2 replies; 5+ messages in thread
From: tomas @ 2023-10-05 7:34 UTC (permalink / raw)
To: guile-user
[-- Attachment #1: Type: text/plain, Size: 1986 bytes --]
On Thu, Oct 05, 2023 at 08:39:48AM +0200, Damien Mattei wrote:
> hello,
> i have problem i do not understand when inserting a file in a module,
> things i never done before:
>
> (define-module (matrix)
>
> #:use-module (oop goops)
>
> #:use-module ((guile)
> #:select (*)
> #:prefix orig:)
>
> #:export (<matrix>
> matrix
> matrix-v)
>
> )
>
> (define scheme-plus-path "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile")
>
> (include (string-append scheme-plus-path "/Scheme+.scm"))
>
> ...
>
> i get this error:
> scheme@(guile-user)> (use-modules (matrix))
> ;;; note: source file /usr/local/share/guile/site/3.0/matrix.scm
> ;;; newer than compiled
> /Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/matrix.scm.go
> ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
> ;;; or pass the --no-auto-compile argument to disable.
> ;;; compiling /usr/local/share/guile/site/3.0/matrix.scm
> ;;; WARNING: compilation of /usr/local/share/guile/site/3.0/matrix.scm failed:
> ;;; In procedure string-prefix?: Wrong type argument in position 2
> (expecting string): (string-append scheme-plus-path "/Scheme+.scm")
> While compiling expression:
> In procedure string-prefix?: Wrong type argument in position 2
> (expecting string): (string-append scheme-plus-path "/Scheme+.scm")
>
> but it works if i replace the string-append by the string already appended :
> (include "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile/Scheme+.scm")
I'd guess that the define makes the binding available at run
time and thus include comes "too early" (i.e. compile time):
the variable somehow already exists as far as include can see
but has no value...
I don't know whether it is TRT, but you might try wrapping your
define form in (eval-when (compile) ...) or similar.
But see the doc of eval-when, especially if you have any cats.
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: inserting a file in a module?
2023-10-05 7:34 ` tomas
@ 2023-10-05 9:12 ` Damien Mattei
2023-10-06 7:14 ` Damien Mattei
1 sibling, 0 replies; 5+ messages in thread
From: Damien Mattei @ 2023-10-05 9:12 UTC (permalink / raw)
To: tomas; +Cc: guile-user
yes , you're right , it is like preprocessor in C , include is like a
directive, files are included and later all is evaluated...
On Thu, Oct 5, 2023 at 9:35 AM <tomas@tuxteam.de> wrote:
>
> On Thu, Oct 05, 2023 at 08:39:48AM +0200, Damien Mattei wrote:
> > hello,
> > i have problem i do not understand when inserting a file in a module,
> > things i never done before:
> >
> > (define-module (matrix)
> >
> > #:use-module (oop goops)
> >
> > #:use-module ((guile)
> > #:select (*)
> > #:prefix orig:)
> >
> > #:export (<matrix>
> > matrix
> > matrix-v)
> >
> > )
> >
> > (define scheme-plus-path "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile")
> >
> > (include (string-append scheme-plus-path "/Scheme+.scm"))
> >
> > ...
> >
> > i get this error:
> > scheme@(guile-user)> (use-modules (matrix))
> > ;;; note: source file /usr/local/share/guile/site/3.0/matrix.scm
> > ;;; newer than compiled
> > /Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/matrix.scm.go
> > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
> > ;;; or pass the --no-auto-compile argument to disable.
> > ;;; compiling /usr/local/share/guile/site/3.0/matrix.scm
> > ;;; WARNING: compilation of /usr/local/share/guile/site/3.0/matrix.scm failed:
> > ;;; In procedure string-prefix?: Wrong type argument in position 2
> > (expecting string): (string-append scheme-plus-path "/Scheme+.scm")
> > While compiling expression:
> > In procedure string-prefix?: Wrong type argument in position 2
> > (expecting string): (string-append scheme-plus-path "/Scheme+.scm")
> >
> > but it works if i replace the string-append by the string already appended :
> > (include "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile/Scheme+.scm")
>
> I'd guess that the define makes the binding available at run
> time and thus include comes "too early" (i.e. compile time):
> the variable somehow already exists as far as include can see
> but has no value...
>
> I don't know whether it is TRT, but you might try wrapping your
> define form in (eval-when (compile) ...) or similar.
>
> But see the doc of eval-when, especially if you have any cats.
>
> Cheers
> --
> t
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: inserting a file in a module?
2023-10-05 7:34 ` tomas
2023-10-05 9:12 ` Damien Mattei
@ 2023-10-06 7:14 ` Damien Mattei
2023-10-06 7:52 ` tomas
1 sibling, 1 reply; 5+ messages in thread
From: Damien Mattei @ 2023-10-06 7:14 UTC (permalink / raw)
To: tomas; +Cc: guile-user
On Thu, Oct 5, 2023 at 9:35 AM <tomas@tuxteam.de> wrote:
> I don't know whether it is TRT, but you might try wrapping your
> define form in (eval-when (compile) ...) or similar.
i tried this:
(eval-when (compile) (define scheme-plus-path
"/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile"))
(include (string-append scheme-plus-path "/" "Scheme+.scm"))
but still have the error:
In procedure string-prefix?: Wrong type argument in position 2
(expecting string): (string-append scheme-plus-path "/" "Scheme+.scm")
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: inserting a file in a module?
2023-10-06 7:14 ` Damien Mattei
@ 2023-10-06 7:52 ` tomas
0 siblings, 0 replies; 5+ messages in thread
From: tomas @ 2023-10-06 7:52 UTC (permalink / raw)
To: Damien Mattei; +Cc: guile-user
[-- Attachment #1: Type: text/plain, Size: 950 bytes --]
On Fri, Oct 06, 2023 at 09:14:50AM +0200, Damien Mattei wrote:
> On Thu, Oct 5, 2023 at 9:35 AM <tomas@tuxteam.de> wrote:
>
> > I don't know whether it is TRT, but you might try wrapping your
> > define form in (eval-when (compile) ...) or similar.
> i tried this:
> (eval-when (compile) (define scheme-plus-path
> "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile"))
>
> (include (string-append scheme-plus-path "/" "Scheme+.scm"))
>
> but still have the error:
> In procedure string-prefix?: Wrong type argument in position 2
> (expecting string): (string-append scheme-plus-path "/" "Scheme+.scm")
Interesting. Even with the shotgun approach
(eval-when (expand load eval compile)
...)
include isn't seeing a value for the defined variable. My hunch is now
that the define itself is special. There's some note in the docs about
that, but I'm ATM at $DAYJOB and not supposed to be doing this :)
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-06 7:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-05 6:39 inserting a file in a module? Damien Mattei
2023-10-05 7:34 ` tomas
2023-10-05 9:12 ` Damien Mattei
2023-10-06 7:14 ` Damien Mattei
2023-10-06 7:52 ` tomas
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).