[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Help solving this phasing problem.
From: |
Felix |
Subject: |
Re: [Chicken-users] Help solving this phasing problem. |
Date: |
Sun, 13 Feb 2011 13:59:47 +0100 (CET) |
From: Peter Bex <address@hidden>
Subject: Re: [Chicken-users] Help solving this phasing problem.
Date: Sat, 12 Feb 2011 22:51:05 +0100
> On Sat, Feb 12, 2011 at 04:35:23PM -0500, Patrick Li wrote:
>>
>> I have a *very* ugly workaround right now.
>> I define the convenience function twice. Once normally. And again within a
>> begin-for-syntax form.
>
> You can do the same trick as before:
>
> (module module-a (convenience-function)
> (import chicken scheme)
>
> (define (convenience-function)
> (display "do convenience things\n")))
>
> (module module-b (my-macro convenience-function)
> (import chicken scheme module-a)
> (import-for-syntax module-a)
> (define-syntax my-macro
> (lambda (expression rename comparison)
> (convenience-function)
> "My Macro Output")))
>
> This imports module-a (which can be internal and nobody has to know it's
> there) both for syntax and normally, and then re-exports the convenience
> function.
>
> Yes, this is ugly.
Well, is it? What could be an alternative? Perhaps something like
(define-syntax begin-<yes...what?>
(syntax-rules ()
((_ forms ...)
(begin
(begin-for-syntax forms ...)
forms ...))))
?
cheers,
felix