[r6rs-discuss] [Formal] Replacing the import's "for" syntax with implicit phasing

From: Felix Klock <pfr6rs>
Date: Thu Nov 16 12:50:45 2006

On Nov 15, 2006, at 1:03 AM, Abdulaziz Ghuloum wrote:

> Now that we have defsyntax, we can use it in another library:
>
> (library definlined
> (export definlined)
> (import (for defsyntax ???))
> (defsyntax#0 (definlined name value)
> (defsyntax#1 (name) value)))
>
> Spend a minute or two to try to puzzle out the import phases for
> defsyntax.

My initial thought is that the import phase for defsyntax is just
'run'; yes, defsyntax appears in the right hand side of the macro
definition of definlined, but only as part of something that is going
to go into the produced code when the use of definlined is expanded,
not something that is going to be run at expansion time of definlined.

You should have put down what your expected answer was, because . . .

> Using definlined is now straightforward:
>
> (library C
> (export c)
> (import (for definlined run))
> (definlined c 5))
>
> (library D
> (export)
> (import r6rs C)
> (display (c)))
>
> In order to compile D, we first:
> visit C at phase 0, causing
> visit definlined at phase 0, causing
> visit defsyntax at phase 0, causing
> visit r6rs at phase 0 and
> visit and invoke r6rs at phase 1
> visit and invoke defsyntax at phase 1, causing
> visit and invoke r6rs at phase 1 and
> visit and invoke r6rs at phase 2

. . . here is seems you've assumed that we've written (for defsyntax
run expand), when I would have just written (for defsyntax run).

(Unless I've done an incorrect back-inference of what you wrote for
the import within the definlined library)

-Felix
Received on Thu Nov 16 2006 - 12:50:40 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC