[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with LOAD and latest build

From: Andy Wingo
Subject: Re: Problems with LOAD and latest build
Date: Sun, 30 Aug 2009 16:17:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi Barry,

Thank you for the bug report, it was quite interesting.

On Sat 29 Aug 2009 17:49, Barry Fishman <address@hidden> writes:

> #! /bin/sh
> # -*- scheme -*-
> exec guile -s "$0" $*
> !#
> (load "dotimes.scm")
> (dotimes (indx 5)
>   (display indx)
>   (newline))

When compiling tryme, what happens is that `(load "dotimes.scm")' gets
compiled into a load at runtime -- but the dotimes.scm isn't loaded at
compile time.

Normally this wouldn't be a problem, but really what you want in this
case is for dotimes.scm to be loaded at compile time as well -- so that
the `dotimes' syntactic definition is present, so that the `dotimes'
invocation in `tryme' expands out to the right thing, instead of a call
to the dotimes function with three arguments.

So, your solutions are to either:

  (eval-when (eval load compile)
    (load "dotimes.scm"))

Or to put dotimes in a module. (Loading modules happens at compile time
as well.)

Now, does this indicate a bug in Guile, or at least an undesirable
behavior? That I do not know. You need to be careful with `load', that
if it provides syntactic definitions, you should probably load it at
compile time as well. This part of R5RS Scheme is somewhat
underspecified. Other schemes provide various load-for-syntax forms, or
loading modules for syntax forms.

For now what I would suggest is that you put your macro in a module.
Otherwise, do the eval-when dance. Or, if you have a better idea about
how this should work, I'd be interested in that, too.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]