Re: Reference implementation's use of datum->syntax is not portable
Physics 12 Aug 2008 15:33 UTC
On Tue, 12 Aug 2008, William D Clinger wrote:
> Derick Eddington wrote:
>> The syntax object #'define-record-type-helper in the
>> below makes the list not be a datum value. This prevents
>> the reference implementation from working in PLT Scheme
>> and Ikarus.
>
> Sorry about that. A corrected reference implementation,
> with the naming convention proposed by the current draft
> SRFI 97, is online at
>
> http://www.ccs.neu.edu/home/will/R6RS/srfi-99.sps
Just a little note regarding correctness of the implementation. The snippet
(datum->syntax
#'tname
`(,type-name ,fields ,parent
,(if constructor-args
(list constructor-name constructor-args)
constructor-name)
,predicate-name
,accessor-fields ,mutator-fields))))))
is hygienically incorrect. If the constructor, predicate,
accessor or mutator names are /not/ omitted by the user, they should not be
stripped of their color as the above snippet does. After all, two of these
names may be symbolically the same but have different colors, which would be
lost with the above implementation. What the above
macro does would be analogous to a LET macro that gives all the left hand side
variables the same color context as the LET keyword, forgetting their
colors, which would be incorrect.
Andre