chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] Improve hygiene of FFI macros


From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Improve hygiene of FFI macros
Date: Tue, 9 Apr 2019 12:48:16 +0200
User-agent: NeoMutt/20170113 (1.7.2)

Hi all,

I had a quick look at #1346 (which I haven't fixed yet) but then quickly
noticed that define-external expands into "define" in an unhygienic way.
You can notice this if you have a module with an import of ONLY
(chicken foreign) but not scheme.

Of course this is not a very common thing to do, which is why we never
ran into it.

I've modified one test to trigger an error with the current version, and
fixed several issues with it.  The fix is probably not 100% complete (and
the test certainly isn't), but it's certainly an improvement.

The patch is somewhat large but straightforward.  It replaces all uses of
just "quote" (via the single quote character) to "##core#quote", uses of
plain "let" to ##core#let, and it adds some missing macros to the syntax
environment so that the macros can expand properly to the intended macro
calls.  I'm not sure if we should pick just the used definitions from the
macro environment (which is what I did here with alist-ref), or if we
should just take the entire original macro environment (which would be
more convenient and less error-prone when we change any macros to make
use of other, new macros but also slightly slower(?)).

Cheers,
Peter

Attachment: 0001-Improve-hygiene-of-FFI-macros.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]