[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] How to compile chicken scheme to Windows DLL?
From: |
Chris Vine |
Subject: |
Re: [Chicken-users] How to compile chicken scheme to Windows DLL? |
Date: |
Mon, 16 Feb 2015 17:09:40 +0000 |
On Mon, 16 Feb 2015 09:09:03 +0100
Christian Kellermann <address@hidden> wrote:
> "Ryuho Yokoyama" <address@hidden> writes:
>
> >>Do you have any special reason to be using such an old CHICKEN?
> >
> > Yes, as stating in reply mail to Mr. Oleg Kolosov, I am now
> > converting all my CL code to Scheme(Chicken, Gambit).
> > In original code there are many "define-macro". Because Chicken
> > Ver 4 does not support "define-macro" I am
> > using the Ver 3.
>
> Please note that with CHICKEN 4 it is still possible to write
> unhygienic macros using explicit / implicit renaming macros.
>
> In my experience this is trivial to do most of the time, so instead of
> using an old version of chicken that is unsupported and misses a lot
> of performance enhancements (specialisations of code, improvements in
> the number tower, scheduler bugfixes to name a few) I urge you to
> reconsider using a recent version.
I think it should also be relatively straightforward to emulate
define-macro using two nested explicit renaming macros, if the
idea is to use define-macro as a lowest common denominator of all
schemes. Of course it would suffer from all the lack of hygiene
that define-macro does, but it might be acceptable as a stop gap
while working code is moved to using renaming macros properly.
If the OP is using normal define-macro syntax I think this will work
(on a couple of trivial tests it seems to do what is wanted, your
mileage may vary):
(define-syntax define-macro
(er-macro-transformer
(lambda (exp0 r0 c0)
(let ([name (caadr exp0)]
[formals (cdadr exp0)]
[body (cddr exp0)])
`(define-syntax ,name
(er-macro-transformer
(,(r0 'lambda) (,(r0 'exp1) ,(r0 'r1) ,(r0 'c1))
(,(r0 'apply) (,(r0 'lambda) ,formals ,@body) (,(r0 'cdr) ,(r0
'exp1))))))))))
If the OP is using defmacro syntax it would require some tweaks to
the opening let clauses.
Chris