# Question about syntax-local-lift-require

**URL:** <https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073>\
**Category:** Questions & Answers\
**Created:** [June 9, 2022, 4:09am UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073 "2022-06-09T04:09:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![symingz](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@symingz](https://racket.discourse.group/u/symingz)\
**Post date:** [June 9, 2022, 4:09am UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073/1 "2022-06-09T04:09:26Z")

</div>

Hi,

The documentation of [`syntax-local-lift-require`](https://docs.racket-lang.org/reference/stxtrans.html#(def._((quote._~23~25kernel)._syntax-local-lift-require))) says

> If raw-require-spec and stx are part of the input to a transformer, then typically syntax-local-introduce should be applied to each before passing them to syntax-local-lift-require, and then syntax-local-introduce should be applied to the result of syntax-local-lift-require. Otherwise, marks added by the macro expander can prevent access to the new imports.

But the two applications of `syntax-local-introduce` to `stx` will just cancel each other, so what's the purpose of applying `syntax-local-introduce` to `stx`?

---

<div class="post-metadata">

**Author:** ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)\
**Post date:** [June 9, 2022, 11:23am UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073/2 "2022-06-09T11:23:08Z")

</div>

In the interval between the two points in time, the expander views potential identifiers as "syntax-locally-introduced” and acts accordingly. But that’s of course not the reality. So at the end, your macro removes these scopes again to set up the proper bindings.

---

<div class="post-metadata">

**Author:** ![gus-massa](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gus-massa/32/507_2.png) [@gus-massa](https://racket.discourse.group/u/gus-massa)\
**Post date:** [June 9, 2022, 2:57pm UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073/3 "2022-06-09T14:57:30Z")

</div>

Perhaps it was necesary when syntax marks were not conmutative??

---

<div class="post-metadata">

**Author:** ![symingz](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@symingz](https://racket.discourse.group/u/symingz)\
**Post date:** [June 10, 2022, 1:22am UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073/4 "2022-06-10T01:22:56Z")

</div>

> [@gus-massa](#):
>
> Perhaps it was necesary when syntax marks were not conmutative??

What does it mean for syntax marks to be noncommutative?

---

<div class="post-metadata">

**Author:** ![symingz](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@symingz](https://racket.discourse.group/u/symingz)\
**Post date:** [June 10, 2022, 1:35am UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073/5 "2022-06-10T01:35:53Z")

</div>

> [@EmEf](#):
>
> In the interval between the two points in time, the expander views potential identifiers as "syntax-locally-introduced” and acts accordingly. But that’s of course not the reality. So at the end, your macro removes these scopes again to set up the proper bindings.

I see your point. Except as the function description says (and I checked the function's source code to confirm), all `syntax-local-lift-require` does is (1) do a `require` lift, which does not use `stx` in anyway, and (2) add a scope to `stx` and return it. So it doesn't matter if `stx` is "syntax-locally-introduced” or not within `syntax-local-lift-require`.

---

<div class="post-metadata">

**Author:** ![gus-massa](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gus-massa/32/507_2.png) [@gus-massa](https://racket.discourse.group/u/gus-massa)\
**Post date:** [June 10, 2022, 5:45pm UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073/6 "2022-06-10T17:45:06Z")

</div>

> [@symingz](#):
>
> What does it mean for syntax marks to be noncommutative?

For example in this program:

```
#lang racket

(define id #'hello)

(define mark1 (make-syntax-introducer))
(define mark2 (make-syntax-introducer))

(bound-identifier=? (mark1 (mark2 (mark2 (mark1 id)))) id)
(bound-identifier=? (mark1 (mark2 (mark1 (mark2 id)))) id)

```

In the curent version of Rackert, both results are `#t`.

IIRC up to version 6.2 the results were `#t` and `#f`, because marks could only remove a "consecutive" identical mark.

---

<div class="post-metadata">

**Author:** ![symingz](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@symingz](https://racket.discourse.group/u/symingz)\
**Post date:** [June 12, 2022, 7:56pm UTC](https://racket.discourse.group/t/question-about-syntax-local-lift-require/1073/7 "2022-06-12T19:56:29Z")

</div>

I see. I think syntax-marks are commutative now, as the Racket Reference make it pretty clear that the scopes associated with a syntax object form a _scope set_.
