[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] Fix coops and probably other eggs by fixing sy
From: |
Peter Bex |
Subject: |
[Chicken-hackers] [PATCH] Fix coops and probably other eggs by fixing syntax-rules and rejecting keywords as identifiers in binding forms |
Date: |
Fri, 3 May 2019 21:20:15 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
Hi all,
The attached patch is quite straightforward and should fix the issues
we've seen with the "coops" and "matchable" eggs. The reason coops
would fail was that it contained a (match options '((reader: x) ...))
call, which would be expanded by syntax-rules into a pattern variable,
which then would fail due to the fact that it would be put into a let
form.
The diff in synrules.scm fixes that part. I also then changed the
binding forms from expand.scm and chicken-syntax to use "variable"
instead of "symbol" in their ##sys#check-syntax calls. This now no
longer allows keywords. This avoids the weird "internal" error about
keywords not having plists when you try something like (define foo: 1).
Instead, you just get "identifier expected", which is clearer to the
user and causes these macros to bail out much earlier.
I'm pretty sure these aren't all assumptions in the compiler that
symbols and keywords are the same, but this should cover 90% of the
typical situations. We could consider making symbols and keywords
completely distinct objects by having symbol? return #f on keywords.
That probably requires a CR, though. It might be wise to do, as it
would completely eradicate this class of errors.
Cheers,
Peter
0001-Reject-keywords-as-identifiers-in-binding-forms.patch
Description: Text Data
signature.asc
Description: PGP signature
- [Chicken-hackers] [PATCH] Fix coops and probably other eggs by fixing syntax-rules and rejecting keywords as identifiers in binding forms,
Peter Bex <=