On 09/23/2016 02:43 PM, 'William J. Bowman' via Racket Users wrote:
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.

It appears that the constructor macro (implemented by self-ctor-transformer in racket/private/define-struct.rkt) transfers the syntax properties from the macro use to its expansion (see the datum->syntax in the first syntax-case clause). Then the properties get duplicated because of the merging step described here: http://docs.racket-lang.org/reference/stxprops.html.

Perhaps that datum->syntax shouldn't copy the properties over?

Ryan

--
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.

Reply via email to