hello, I try to build some basic script wich use external macro with -i switch from gsc and I encounter an annoying error.
Here is the simple test : @ ll total 6 -rw-r--r-- 1 cydu cydu 60 May 5 10:36 build.scm -rw-r--r-- 1 cydu cydu 39 May 5 10:36 test-macro.scm -rw-r--r-- 1 cydu cydu 55 May 5 10:36 test-simple.scm @ more test-macro.scm (define-macro (my-macro x) `(+ x 1)) @ more test-simple.scm (define my-func (lambda (x) (+ x (my-macro x)))) @ more build.scm (include "test-macro.scm") (compile-file "test-simple.scm") @ gsc-gambit -i build.scm @ gsi-gambit Gambit v4.6.4
(load "test-simple")
*** WARNING -- Variable "my-macro" used in module "test-simple.o1" is undefined "/usr/users/cydu/tmp/bug-test/test-simple.o1"
*** EOF again to exit @ rm test-simple.o1 @ gsc-gambit Gambit v4.6.4
(include "test-macro.scm") (compile-file "test-simple.scm")
"/usr/users/cydu/tmp/bug-test/test-simple.o1"
*** EOF again to exit @ gsi-gambit Gambit v4.6.4
(load "test-simple")
"/usr/users/cydu/tmp/bug-test/test-simple.o1"
(my-func 3)
7
It fails from the i switch and succeed when I launch gsc and type the commands by myself.
It seems that the -i switch from gsc does not load the macro when it compile my file. Any idea about what might cause that annoying error ?
thanks a lot cyrille
Afficher les réponses par date
Since no one else has replied yet, the answer is a variant of "it's not a bug, it's a feature".
site:http://mercure.iro.umontreal.ca/pipermail/gambit-list/ define-macro
Brad
On May 5, 2012, at 5:44 PM, Cyrille Duret wrote:
hello, I try to build some basic script wich use external macro with -i switch from gsc and I encounter an annoying error.
Here is the simple test : @ ll total 6 -rw-r--r-- 1 cydu cydu 60 May 5 10:36 build.scm -rw-r--r-- 1 cydu cydu 39 May 5 10:36 test-macro.scm -rw-r--r-- 1 cydu cydu 55 May 5 10:36 test-simple.scm @ more test-macro.scm (define-macro (my-macro x) `(+ x 1)) @ more test-simple.scm (define my-func (lambda (x) (+ x (my-macro x)))) @ more build.scm (include "test-macro.scm") (compile-file "test-simple.scm") @ gsc-gambit -i build.scm @ gsi-gambit Gambit v4.6.4
(load "test-simple")
*** WARNING -- Variable "my-macro" used in module "test-simple.o1" is undefined "/usr/users/cydu/tmp/bug-test/test-simple.o1"
*** EOF again to exit @ rm test-simple.o1 @ gsc-gambit Gambit v4.6.4
(include "test-macro.scm") (compile-file "test-simple.scm")
"/usr/users/cydu/tmp/bug-test/test-simple.o1"
*** EOF again to exit @ gsi-gambit Gambit v4.6.4
(load "test-simple")
"/usr/users/cydu/tmp/bug-test/test-simple.o1"
(my-func 3)
7
It fails from the i switch and succeed when I launch gsc and type the commands by myself.
It seems that the -i switch from gsc does not load the macro when it compile my file. Any idea about what might cause that annoying error ?
thanks a lot cyrille _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
mmm seems that I will have to use Makefile instead of gsc -i cyrille
On Monday, May 7, 2012, Bradley Lucier wrote:
Since no one else has replied yet, the answer is a variant of "it's not a bug, it's a feature".
site:http://mercure.iro.umontreal.ca/pipermail/gambit-list/ define-macro
Brad
On May 5, 2012, at 5:44 PM, Cyrille Duret wrote:
hello, I try to build some basic script wich use external macro with -i switch
from gsc and I encounter an annoying error.
Here is the simple test : @ ll total 6 -rw-r--r-- 1 cydu cydu 60 May 5 10:36 build.scm -rw-r--r-- 1 cydu cydu 39 May 5 10:36 test-macro.scm -rw-r--r-- 1 cydu cydu 55 May 5 10:36 test-simple.scm @ more test-macro.scm (define-macro (my-macro x) `(+ x 1)) @ more test-simple.scm (define my-func (lambda (x) (+ x (my-macro x)))) @ more build.scm (include "test-macro.scm") (compile-file "test-simple.scm") @ gsc-gambit -i build.scm @ gsi-gambit Gambit v4.6.4
(load "test-simple")
*** WARNING -- Variable "my-macro" used in module "test-simple.o1" is
undefined
"/usr/users/cydu/tmp/bug-test/test-simple.o1"
*** EOF again to exit @ rm test-simple.o1 @ gsc-gambit Gambit v4.6.4
(include "test-macro.scm") (compile-file "test-simple.scm")
"/usr/users/cydu/tmp/bug-test/test-simple.o1"
*** EOF again to exit @ gsi-gambit Gambit v4.6.4
(load "test-simple")
"/usr/users/cydu/tmp/bug-test/test-simple.o1"
(my-func 3)
7
It fails from the i switch and succeed when I launch gsc and type the
commands by myself.
It seems that the -i switch from gsc does not load the macro when it
compile my file.
Any idea about what might cause that annoying error ?
thanks a lot cyrille _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca javascript:; https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On May 7, 2012, at 10:11 PM, Cyrille Duret wrote:
mmm seems that I will have to use Makefile instead of gsc -i cyrille
You came to that conclusion from reading the mail list archives?
The following works:
First, give the correct definition of my-macro:
[Bradley-Luciers-MacBook-Pro:~/crap] lucier% cat test-macro.scm (define-macro (my-macro x) `(+ ,x 1))
Then, include the macro definitions in the file you want to compile:
[Bradley-Luciers-MacBook-Pro:~/crap] lucier% cat test-simple.scm (include "test-macro.scm") (define my-func (lambda (x) (+ x (my-macro x))))
Then the following works just fine:
[Bradley-Luciers-MacBook-Pro:~/crap] lucier% cat build.scm (compile-file "test-simple.scm") [Bradley-Luciers-MacBook-Pro:~/crap] lucier% gsc -i build.scm [Bradley-Luciers-MacBook-Pro:~/crap] lucier% gsi Gambit v4.6.5
(load "test-simple")
"/Users/lucier/crap/test-simple.o1"
(my-func 2)
5
In fact I want to use the prelude option of the compiler inside the interpreted mode. I have not seen any prelude: option in the compile-file function.
The command line I use actually in my Makefile gsc-gambit -prelude '(include "test-macro.scm")' test-simple.scm
thanks
On Mon, May 7, 2012 at 3:33 PM, Bradley Lucier lucier@math.purdue.eduwrote:
On May 7, 2012, at 10:11 PM, Cyrille Duret wrote:
mmm seems that I will have to use Makefile instead of gsc -i cyrille
You came to that conclusion from reading the mail list archives?
The following works:
First, give the correct definition of my-macro:
[Bradley-Luciers-MacBook-Pro:~/crap] lucier% cat test-macro.scm (define-macro (my-macro x) `(+ ,x 1))
Then, include the macro definitions in the file you want to compile:
[Bradley-Luciers-MacBook-Pro:~/crap] lucier% cat test-simple.scm (include "test-macro.scm") (define my-func (lambda (x) (+ x (my-macro x))))
Then the following works just fine:
[Bradley-Luciers-MacBook-Pro:~/crap] lucier% cat build.scm (compile-file "test-simple.scm") [Bradley-Luciers-MacBook-Pro:~/crap] lucier% gsc -i build.scm [Bradley-Luciers-MacBook-Pro:~/crap] lucier% gsi Gambit v4.6.5
(load "test-simple")
"/Users/lucier/crap/test-simple.o1"
(my-func 2)
5
On May 8, 2012, at 12:20 AM, Cyrille Duret wrote:
In fact I want to use the prelude option of the compiler inside the interpreted mode. I have not seen any prelude: option in the compile-file function.
Ah, so this may be a bug (or a missing feature) but it doesn't appear to have anything specifically to do with macros, really.
The command line I use actually in my Makefile gsc-gambit -prelude '(include "test-macro.scm")' test-simple.scm
Marc?
Brad
On 2012-05-07, at 11:54 AM, Bradley Lucier wrote:
On May 8, 2012, at 12:20 AM, Cyrille Duret wrote:
In fact I want to use the prelude option of the compiler inside the interpreted mode. I have not seen any prelude: option in the compile-file function.
Ah, so this may be a bug (or a missing feature) but it doesn't appear to have anything specifically to do with macros, really.
The command line I use actually in my Makefile gsc-gambit -prelude '(include "test-macro.scm")' test-simple.scm
Marc?
When using the compiler interactively, by calling compile-file, the compiler will automatically import the macros from the interaction environment. So this should suffice:
(eval '(include "test-macro.scm")) (compile-file "test-simple.scm")
Marc
it works great ! Thanks a lot cyrille
On Monday, May 7, 2012, Marc Feeley wrote:
On 2012-05-07, at 11:54 AM, Bradley Lucier wrote:
On May 8, 2012, at 12:20 AM, Cyrille Duret wrote:
In fact I want to use the prelude option of the compiler inside the
interpreted mode.
I have not seen any prelude: option in the compile-file function.
Ah, so this may be a bug (or a missing feature) but it doesn't appear to
have anything specifically to do with macros, really.
The command line I use actually in my Makefile gsc-gambit -prelude '(include "test-macro.scm")' test-simple.scm
Marc?
When using the compiler interactively, by calling compile-file, the compiler will automatically import the macros from the interaction environment. So this should suffice:
(eval '(include "test-macro.scm")) (compile-file "test-simple.scm")
Marc