[racket-dev] syntax property duplication

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed Aug 17 18:25:45 EDT 2011

The following idiom duplicates the syntax properties on `stx':

  (define-syntax (m stx) (datum->syntax #'here 'id stx stx))

This is a problem for me because I use syntax properties to indicate
polymorphic type instantiation.  If an expression that's actually a
macro using this idiom is instatiated, then Typed Racket tries to do
the type instantiation twice, resulting in an error.  See the below
program, which fails.

Should I expect that duplicate syntax properties are a natural result
of expansion, and find some way to handle them?  Or is there something
else that should happen?

#lang typed/racket
(: id : (All (A) (A -> A)))
(define (id x) x)
(define-syntax (m stx) (datum->syntax #'here 'id stx stx))
(inst m Integer)

-- 
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.