Re: [racket-users] syntax-property lost across module boundary (WAS: format-id doesn't preserve preserved?-edness of syntax-property?)

18 views
Skip to first unread message

Matthias Felleisen

unread,
Dec 13, 2016, 3:39:03 PM12/13/16
to William J. Bowman, dev

Matthew: From the hip, I consider this a design bug, namely a violation of the you-want-it-when promise. To make this more precise, I think that William’s bug exposed a bug on the semantics of make-rename-transformer. What do you think?

— Matthias








> On Dec 13, 2016, at 2:23 PM, 'William J. Bowman' via Racket Users <racket...@googlegroups.com> wrote:
>
> After a debugging session with Leif, the problem is actually a user-error caused by sublte issues with macros-generating-macors:
>
> In the failing case, I was generating the following
>
> (with-syntax ([x (format-id ...)])
> #`(begin
> (define x body)
> (define-syntax id
> (make-rename-transformer #'x))))
>
> Notice that #'x is not the same identifier as x, and thus does not have the same syntax-properties.
>
> Why does this issue only comes up across a file boundary? I suspect this has to do with the behavior of make-rename-transformer. Since #'x was not getting 'not-free-identifier=? correctly, make-rename-transformer was optimizing this away, although I thought I was preventing that.
>
> --
> William J. Bowman
>
> PS: Thanks Leif!
>
> On Mon, Dec 12, 2016 at 12:55:24PM -0500, 'William J. Bowman' via Racket Users wrote:
>> Ah, thanks.
>>
>> Anyone else have other ideas for problems using syntax-properties, or maybe make-rename-transformers (with not-free-identifier=?), across modules?
>>
>> --
>> William J. Bowman
>>
>> On Sun, Dec 11, 2016 at 07:54:29PM -0500, Alex Knauth wrote:
>>>
>>>> On Dec 11, 2016, at 7:20 PM, 'William J. Bowman' via Racket Users <racket...@googlegroups.com> wrote:
>>>>
>>>> Before I file a bug report, I want to make sure something *else* isn't going on.
>>>
>>> It looks like "something else" is going on; according to syntax-property-preserved? it's still marked as preserved in the program below.
>>>
>>> #lang racket
>>> (require racket/syntax)
>>>
>>> (define stx (syntax-property #'x 'my-prop 5 #t))
>>> (syntax-property-preserved? stx 'my-prop)
>>> ;=> #true
>>>
>>> ;; transfer properties from stx
>>> (define stx* (format-id #f "y" #:props stx))
>>> (syntax-property-preserved? stx* 'my-prop)
>>> ;=> #true
>>>
>>> Alex Knauth
>>>
>>>> In "format-id1.rkt" (https://gist.github.com/wilbowma/247d15e0e0bed6b239584854e79b5015), I define and export some identifiers with preserved syntax-properties. The identifier "id" is created using format-id with #:props to attach a syntax-property. The identifier "id2" is created using generate-temporary and a syntax-property is attached manually. I also use these the syntax-property in the same file. If I run or compile the file, no errors.
>>>>
>>>> In "format-id2.rkt" (https://gist.github.com/wilbowma/ed071343c8c651f3a78d690a4ab7a392), I use the syntax-properties in exactly the same way. However, if I run or compile the file, I get errors that indicate "id" is missing it's syntax-property.
>>>>
>>>> --
>>>> 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...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages