Two identifiers that are both unbound and have the same symbol are 
considered free-identifier=?. Thus the match works when testing from 
expander-utils.rkt, where both the pattern and usage are unbound. It also 
works from expander-utils.rkt when you define `line` in that file, because 
the pattern and usage identifiers both share that binding. But when you 
define line in expander.rkt, the pattern identifier in expander-utils.rkt 
is unbound, but the usage identifier in expander.rkt is bound by the `line` 
definition, so they aren't free-identifier=?.

On Sunday, September 29, 2019 at 9:21:13 PM UTC-4, Jonathan Simpson wrote:
>
> In expander-utils.rkt the macros work if the line pattern is a datum or 
> literal. In expander.rkt it only works if the line pattern is a datum. So I 
> changed line to only match a datum. From my understanding, I think matching 
> line as a datum is correct, so I'm happy with what I have now. I just don't 
> understand why line also matches as a literal in expander-utils.rkt.
>
> Thanks for your help.
>
> -- Jonathan
>
> On Saturday, September 28, 2019 at 10:51:01 PM UTC-4, Ben Greenman wrote:
>>
>> On 9/28/19, Jonathan Simpson <jjsi...@gmail.com> wrote: 
>> > It works when I change my mag-line syntax class to: 
>> > 
>> > (define-syntax-class mag-line 
>> >     (pattern (line expr ...))) 
>> > 
>> > So removing the literal specifier on line seems to work. I'm still not 
>> sure 
>> > why the two modules behave differently though. It seemed to work in 
>> > expander-utils.rkt whether line was defined or not. So there must be 
>> > something in the compilation environment that I'm missing. I'm still 
>> > curious if anyone has a good explanation. I may hit issues with level 
>> > further down the road as well. 
>>
>> (~literal X) matches an identifier that is free-identifier=? to X 
>> If X is defined in one module but not another, you'll see different 
>> results. 
>>
>> That new pattern (line expr ....) might match more things than you want 
>> it to. 
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/41960a04-83d0-41cf-ae78-8338dc60953d%40googlegroups.com.

Reply via email to