* problem with srfi-1 when loading from the command line
@ 2005-04-17 0:26 Rick Taube
2005-04-17 5:57 ` Steve Juranich
2005-05-24 17:28 ` Marius Vollmer
0 siblings, 2 replies; 5+ messages in thread
From: Rick Taube @ 2005-04-17 0:26 UTC (permalink / raw)
Im having a problem getting the srfi-1 definition of list-index (which
is defined in both guile and srfi-1) to stay in effect when I load my
system from the command line using the -l option. im not sure what is
going wrong.
I load my program by loading a file called cm.scm, which in turn loads
all my system's sources. The first file that it loads is called
guile.scm which has the following use-modules in it:
---
(use-modules (srfi srfi-1))
(use-modules (oop goops))
(use-modules (ice-9 rdelim))
(use-modules (ice-9 pretty-print)) ; remove at some point...
---
Now, if I start up Guile first and THEN load cm.scm from inside it
then everything works, as shown in this trace:
THIS WORKS:
galen:/Lisp/cm hkt$ guile
guile> (version)
"1.6.7"
guile> list-index
#<procedure list-index (l k)> ; <- the old
list-index
guile> (load "/Lisp/cm/src/cm.scm")
; loading guile.scm
; loading loop.scm
; loading level1.scm
; loading utils.scm
; loading mop.scm
; loading objects.scm
; loading io.scm
; loading scheduler.scm
; loading sco.scm
; loading clm.scm
; loading clm2.scm
; loading midi1.scm
; loading midi2.scm
; loading midi3.scm
; loading data.scm
; loading scales.scm
; loading spectral.scm
; loading patterns.scm
guile> list-index
#<procedure list-index (pred clist1 . rest)> ; <- the new one
guile> (quit)
NOW, if i load my program from the command line using -l option then it
doesnt work, and adding --use-srfi=1 does not help (ive tried with and
without the --use-srfi option)
THIS DOES NOT WORK:
galen:/Lisp/cm hkt$ guile --use-srfi="1" -l "/Lisp/cm/src/cm.scm"
; loading guile.scm
; loading loop.scm
; loading level1.scm
; loading utils.scm
; loading mop.scm
; loading objects.scm
; loading io.scm
; loading scheduler.scm
; loading sco.scm
; loading clm.scm
; loading clm2.scm
; loading midi1.scm
; loading midi2.scm
; loading midi3.scm
; loading data.scm
; loading scales.scm
; loading spectral.scm
; loading patterns.scm
guile> list-index
#<procedure list-index (l k)> ; <- the old version is still set
guile> (quit)
As you can see, the list-index function was not redefined by srfi-1, or
maybe it was and something that i dont understand is happeing. Any
ideas what is going on? All the other definitions that i am using in
srfi-1 are in effect. This happens in guile 1.6.7 and 1.7.1
thanks
--rick
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem with srfi-1 when loading from the command line
2005-04-17 0:26 problem with srfi-1 when loading from the command line Rick Taube
@ 2005-04-17 5:57 ` Steve Juranich
2005-05-24 17:28 ` Marius Vollmer
1 sibling, 0 replies; 5+ messages in thread
From: Steve Juranich @ 2005-04-17 5:57 UTC (permalink / raw)
On 4/16/05, Rick Taube <taube@uiuc.edu> wrote:
> Im having a problem getting the srfi-1 definition of list-index (which
> is defined in both guile and srfi-1) to stay in effect when I load my
> system from the command line using the -l option. im not sure what is
> going wrong.
This is kind of a knee-jerk reaction (I really should be in bed by
now), but perhaps guile is loading the SRFI module before it brings in
all of those "base" definitions. I guess that doesn't make a lot of
sense, and I'm not sure how you'd prove that was happening. Like I
said, I'm really tired. :-)
Good luck.
--
Steve Juranich
Tucson, AZ
USA
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem with srfi-1 when loading from the command line
@ 2005-04-18 3:10 Mike Gran
0 siblings, 0 replies; 5+ messages in thread
From: Mike Gran @ 2005-04-18 3:10 UTC (permalink / raw)
Rick-
Tried it out. I agree that it doesn't work, just as you described.
I was able to verify that the problem isn't in the order that things
are being defined. The normal "list-index" gets defined first and then
the srfi-1 "list-index" gets defined later.
Once the guile prompt comes up, "list-index", "map-in-order",
"for-each" and a bunch of other srfi-1 overwritten functions get
un-overwritten for some reason. Don't know why. Something about then
environment of the script being different from the environment of the
guile prompt?
Here's a workaround... Call the following file with "guile -s tmp.scm"
instead of "guile -l tmp.scm"
---
;; tmp.scm
(use-modules
(srfi srfi-1)
(oop goops)
(ice-9 rdelim)
(ice-9 pretty-print))
(scm-style-repl)
---
The "scm-style-repl" kicks off a new guile prompt in which the commands
at the prompt have the same environment as the script. list-index
should then work as expected.
Hope this helps.
--
Mike Gran
--
>
> As you can see, the list-index function was not redefined by srfi-1,
> or
> maybe it was and something that i dont understand is happeing. Any
> ideas what is going on? All the other definitions that i am using in
> srfi-1 are in effect. This happens in guile 1.6.7 and 1.7.1
>
> thanks
> --rick
>
>
>
__________________________________
Do you Yahoo!?
Plan great trips with Yahoo! Travel: Now over 17,000 guides!
http://travel.yahoo.com/p-travelguide
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem with srfi-1 when loading from the command line
2005-04-17 0:26 problem with srfi-1 when loading from the command line Rick Taube
2005-04-17 5:57 ` Steve Juranich
@ 2005-05-24 17:28 ` Marius Vollmer
2005-05-24 17:57 ` Neil Jerram
1 sibling, 1 reply; 5+ messages in thread
From: Marius Vollmer @ 2005-05-24 17:28 UTC (permalink / raw)
Cc: guile-user
Rick Taube <taube@uiuc.edu> writes:
> Im having a problem getting the srfi-1 definition of list-index (which
> is defined in both guile and srfi-1) to stay in effect when I load my
> system from the command line using the -l option. im not sure what is
> going wrong.
That is actually a 'feature' because of this code in boot-9.scm that
is executed just before the REPL starts:
;; so that builtin bindings will be checked first
(module-use! guile-user-module (resolve-interface '(ice-9 r5rs)))
(module-use! guile-user-module (resolve-interface '(guile)))
The builtin bindings come from the (guile), and using it last will
shadow all previous bindings.
I agree that this is not really wanted. So I vote for removing the
last line of the code snippet above. The (guile) module is used
anyway in every module. Ok?
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem with srfi-1 when loading from the command line
2005-05-24 17:28 ` Marius Vollmer
@ 2005-05-24 17:57 ` Neil Jerram
0 siblings, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2005-05-24 17:57 UTC (permalink / raw)
Cc: Rick Taube, guile-user
Marius Vollmer wrote:
>
> I agree that this is not really wanted. So I vote for removing the
> last line of the code snippet above. The (guile) module is used
> anyway in every module. Ok?
>
OK with me.
Neil
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-05-24 17:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-17 0:26 problem with srfi-1 when loading from the command line Rick Taube
2005-04-17 5:57 ` Steve Juranich
2005-05-24 17:28 ` Marius Vollmer
2005-05-24 17:57 ` Neil Jerram
-- strict thread matches above, loose matches on Subject: below --
2005-04-18 3:10 Mike Gran
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).