[plt-scheme] Custom expansion and certificates

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 15 07:06:25 EDT 2010

At Sun, 14 Mar 2010 16:11:32 -0600, Neil Toronto wrote:
> Last question: Why do 'match' and 'for' mark the syntax twice, with 
> syntax-local-introduce on the outside?

To keep canceling marks adjacent, instead of having the alternate
transformer's mark between marks that were intended to cancel.

The syntax object in question is expected to have some mark M. When the
`for' or `match' macro completes, M will be applied to the result for
cancel the original M. If M' is added in between, then the marks won't
cancel. So, the extra marks turn

   M M' M

into

   M M M' M M

so that the Ms cancel. Meanwhile, if some bit of syntax is not from the
input, it ends up with (adding marks to the right)

   M M' M M

and so the first M sticks to indicate introduced syntax.



Posted on the users mailing list.