Under certain conditions, the value of a syntax property is duplicated.
I can't figure out why, or if this is a bug, and any advice would be 
appreciated.

I've attached the smallest program that generates this behavior that I've 
managed to find.

The conditions seem to be:

1. Write a syntax object that
  - represents an application of constructor for a struct to some value.
  - has an attached syntax property; suppose this property's key is 'x and 
value is '1.
  - does not manually use `#%app` to apply the constructor.
2. Use `local-expand` on a use of this macro.

Before using `local-expand`, the syntax object has a property 'x with value '1.
The result of `local-expand` will have a property 'x with a value of '(1 . 1).
If you manually use `#%app` to apply the constructor, or apply a procedure 
instead of a constructor,
then the result of `local-expand` will have a property 'x and a value of '1.

-- 
William J. Bowman
Northeastern University
College of Computer and Information Science

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#lang racket/base
(require
 (for-syntax
  rackunit
  racket/base))

(struct test (val))

(define (id x) x)

(begin-for-syntax
  (define (my-expand syn)
    (local-expand syn 'expression '()))

  (check-equal?
   (syntax-property (my-expand (syntax-property #`(test 1) 'test 1)) 'test)
   1)

  (check-equal?
   (syntax-property (my-expand (syntax-property #`(#%app test 1) 'test 1)) 
'test)
   1)

  (check-equal?
   (syntax-property (my-expand (syntax-property #`(id 1) 'test 1)) 'test)
   1))

Attachment: signature.asc
Description: PGP signature

Reply via email to