chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] Fix for #884


From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Fix for #884
Date: Sat, 7 Jul 2012 11:56:13 +0200
User-agent: Mutt/1.4.2.3i

Hi all,

Here's a patch that fixes #884.  The problem was that when modules
declarations are canonicalized, all subexpressions are canonicalized
in the dynamic extent of a with-property-restore.

The define-type call expands to a call to ##sys#put/restore!, which
sets a property on the user-defined type's symbol which will be restored
as soon as with-property-restore returns.  Originally, ##core#the calls
would simply be kept (but stripped of all syntax), which means the
final form would be (##core#the footype #t '"bar").  This form survives
the call to with-property-restore and thus the canonicalization process.
(you can see this when you run "csc -scrutinize -debug 2 test.scm")

The scrutinizer gets invoked much later when the complete source has
been canonicalized, but at this time it doesn't know about this footype
anymore and you get the error.  The reason it works when the custom type
is defined outside a module is because there is no with-property-restore
call involved in canonicalization of the toplevel forms.

The fix is simple; make the canonicalization process canonicalize type
names to core names by looking up the custom name and converting it to
a "core" typename while still inside the dynamic extent of
the with-property-restore call in canonicalize-expression.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: 0001-Resolve-user-defined-scrutiny-types-at-canonicalizat.patch
Description: Text document


reply via email to

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