<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Hi Jens Axel,</DIV>
<DIV>Thanks, Yes I guessed the problem was located there.</DIV>
<DIV>I understand that the two transformers produce syntactically distinct
identifiers, but I would not know how to make them identical. I have tried
(quasi)syntax/loc, but that did not work either. Is there a solution for this
problem? If so, can you give me some extra hint? Included is a cleaner version
of the code.</DIV>
<DIV>Jos</DIV>
<DIV> </DIV>
<DIV>(((((lambda(x)((((((((x x)x)x)x)x)x)x)x))<BR>
(lambda(x)(lambda(y)(x(x y)))))<BR> (lambda(x)(x)x))<BR>
(lambda()(printf "Greetings, Jos~n"))))</DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=jensaxel@soegaard.net href="mailto:jensaxel@soegaard.net">Jens Axel
Søgaard</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=samth@ccs.neu.edu
href="mailto:samth@ccs.neu.edu">Sam TH</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=jos.koot@telefonica.net
href="mailto:jos.koot@telefonica.net">jos koot</A> ; <A
title=plt-scheme@list.cs.brown.edu
href="mailto:plt-scheme@list.cs.brown.edu">plt-scheme@list.cs.brown.edu</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, March 11, 2007 3:08
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [plt-scheme] Dot-notation
for structure field access</DIV>
<DIV><BR></DIV>Sam TH skrev:<BR>> I haven't tested this, but you almost
certainly need to add<BR>> <BR>> (require-for-template mzscheme)<BR>>
<BR>> to the `dot' module.<BR><BR>For some reason that's not
enough.<BR><BR>The error stems from the line<BR><BR>
(id
#'((make-struct-field-accessor #,acc #,n) 0 #,var))<BR><BR>in
register-transformer-builder.<BR><BR>The examples starts
with:<BR><BR> (define-struct-type d c p (x y z)
(make-inspector))<BR><BR>which starts this transformer:<BR><BR>(define-syntax
(define-struct-type stx)<BR> (syntax-case stx
()<BR> <irrelevant clauses><BR>
((define-struct-type (descr constr pred super) (field ...)
inspector)<BR> (let-values (((acc
mut)<BR> (apply values
(generate-temporaries #'(acc mut)))))<BR>
(register-transformer-builder #'constr #'(field ...) acc
mut)<BR> #`(define-values (descr constr pred #,acc
#,mut)<BR>
(let-values<BR> (((descr constr pred
#,acc #,mut)<BR>
(make-struct-type 'descr
super<BR>
#,(length (syntax->list #'(field
...)))<BR>
0 #f () inspector #f () #f)))<BR>
(values descr constr pred #,acc #,mut)))))))<BR><BR>Then<BR><BR>
(define-struct-var s (c 1 2 add1))<BR><BR>defines s and the s.x, s.y and s.z
via:<BR><BR> (define-syntax (define-struct-var
stx)<BR> (syntax-case stx
()<BR> ((define-struct-var var (constr
expr ...))<BR>
#`(begin<BR>
(define var (constr expr
...))<BR>
#,@((register-lookup #'constr) #'var)))))<BR><BR>The s.x is defined via the
procedure registered by:<BR><BR>(define-for-syntax
(register-transformer-builder constr fields acc
mut)<BR>
(register-add!<BR>
constr<BR> (lambda
(var)<BR> (let ((n
0))<BR>
(map<BR> (lambda
(field)<BR>
(let ((dotted-var (make-id var
field)))<BR>
(begin0<BR>
#`(define-syntax
#,dotted-var<BR>
(make-set!-transformer<BR>
(lambda
(stx)<BR>
(syntax-case stx
(set!)<BR>
((set! id
v)<BR>
#'((make-struct-field-mutator #,mut
#,n)<BR>
#,var
v))<BR>
((id x (...
...))<BR>
#'(((make-struct-field-accessor #,acc
#,n)<BR>
#,var) x (...
...)))<BR>
(id<BR>
#'((make-struct-field-accessor #,acc #,n)
XXX<BR>
0
#,var))))))<BR>
(set! n (add1
n)))))<BR>
(syntax->list fields))))))<BR><BR>I have marked the offending line with
XXX.<BR><BR>-- <BR>Jens Axel Søgaard<BR><BR><BR><BR></BLOCKQUOTE></BODY></HTML>