Re: Lisp2Perl - Lisp to perl compiler
From: Pascal Costanza (costanza_at_web.de)
Date: 01/28/04
- Next message: Gareth McCaughan: "Re: Static/Strong/Implicit Typing"
- Previous message: David: "Re: Lisp2Perl - Lisp to perl compiler"
- In reply to: Joe Marshall: "Re: Lisp2Perl - Lisp to perl compiler"
- Next in thread: Jens Axel Søgaard: "Re: Lisp2Perl - Lisp to perl compiler"
- Reply: Jens Axel Søgaard: "Re: Lisp2Perl - Lisp to perl compiler"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Jan 2004 01:44:13 +0100
Joe Marshall wrote:
> At runtime, though, you want to be able to change a regular function
> into a dynamic one should you so desire.
>
> There's no problem with doing this with Matthew's module system.
OK.
> As should be obvious, utility functions such as `EMBEDDED-DOT-P' and
> `SPLIT-ON-DOTS' *must* be present before we can expand the macros.
> There is simply no way to get around that! When compiling a
> *different* file that uses this macro, you *must* ensure that the file
> that defines EMBEDDED-DOT-P is loaded first. This is a compile-time
> dependency, but this dependency must be maintained.
OK.
> It often happens that you accidentally introduce these dependencies
> through incremental editing of files: you load up the compiled files,
> edit some code, recompile that file, edit some more, do more
> recompiles etc. At some point, you decide to recompile from scratch,
> but all hell breaks loose because you added a macro whose expansion
> depends on code that is compiled *after* the macro is used. It only
> accidentally worked during development because you never attempted to
> recompile the utility file that expanded the macro, only those files
> that used it.
OK, I understand the problem better by now. I actually recall having it.
> What Matthew's module system does is ensure that code that the macro
> *uses* at compile time is in scope at compile time and not
> accidentally obtained from the runtime environment. Errors such as
> the above are caught sooner because incremental compilation and whole
> world compilation are treated more uniformly.
OK, thanks for clarifying my misunderstanding of that paper.
But I still wonder what's the reason why this works:
> (define a 1)
>
> (define-syntax foo
> (syntax-rules ()
> ((foo x) (+ a x))))
>
> (foo 2) => 3
...while that doesn't:
>>(define a 1)
>>(define-macro (foo x) `(+ ,a ,x))
>>(foo 2)
>>
>>This will result in a "reference to undefined identifier" error,
>>because the foo macro doesn't see the a reference.
What's the difference here?
Pascal
-- Tyler: "How's that working out for you?" Jack: "Great." Tyler: "Keep it up, then."
- Next message: Gareth McCaughan: "Re: Static/Strong/Implicit Typing"
- Previous message: David: "Re: Lisp2Perl - Lisp to perl compiler"
- In reply to: Joe Marshall: "Re: Lisp2Perl - Lisp to perl compiler"
- Next in thread: Jens Axel Søgaard: "Re: Lisp2Perl - Lisp to perl compiler"
- Reply: Jens Axel Søgaard: "Re: Lisp2Perl - Lisp to perl compiler"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|