scsh-users
[Top] [All Lists]

Re: weirdness with when macro

To: scsh-news@zurich.ai.mit.edu
Subject: Re: weirdness with when macro
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Mon, 11 Feb 2002 12:42:37 +0100
Organization: Zentrum fuer Datenverarbeitung
>>>>> "Ikke" == Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de> writes:

>>>>> "Brian" == Brian Denheyer <briand@zipcon.net> writes:

Brian> As usual, I always figure things out 10 min after I post.
Brian> It looks as though "loading" a file with syntax definitions doesn't
Brian> seem to work as I would expect.

Brian> The exact same code works just fine if I load the macros using :

Brian> #!/usr/local/bin/scsh \
Brian> -l ~/src/scheme/lib/r5rs-macros.scm -e main -s
Brian> !#

Brian> instead of :
Brian> (load "~/src/scheme/lib/r5rs-macros.scm")

Brian> Does this make sense ?

Ikke> No, since -l calls LOAD.

Ikke> I also cannot reproduce your problem:

Ikke> aubisque[85] cat when.scm
Ikke> (define-syntax when
Ikke>   (syntax-rules 
>> ()
>> ((when test body ...)
>> (if test (begin body ...)))))

Ikke> aubisque[86] scsh
Ikke> Welcome to scsh 0.6.0 (Chinese Democracy)
Ikke> Type ,? for help.
>> (load "when.scm")
Ikke> when.scm
>> (when #f 3)
>> (when #t 3)
Ikke> 3
>> 

Ah, forget about that one, you already mentioned that it works within
the REPL. 

Loading a file that contains another LOAD for macro definitions won't
work since the macro expansion for the first file takes place before
the LOAD for the second file is evaluated. The -l flag however is
evaluated before the script is read into the system so the macros are
present at the right time.

-- 
Martin

<Prev in Thread] Current Thread [Next in Thread>