# A question about free-identifier=?

**URL:** <https://racket.discourse.group/t/a-question-about-free-identifier/685>\
**Category:** Questions & Answers\
**Tags:** macro\
**Created:** [February 12, 2022, 8:29am UTC](https://racket.discourse.group/t/a-question-about-free-identifier/685 "2022-02-12T08:29:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chansey97](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chansey97](https://racket.discourse.group/u/chansey97)\
**Post date:** [February 12, 2022, 8:29am UTC](https://racket.discourse.group/t/a-question-about-free-identifier/685/1 "2022-02-12T08:29:15Z")

</div>

I am learning Racket macro. I have a question about `free-identifier=?`.

Why the following code return #t?

```scheme
(free-identifier=? #'car (let ([car 8]) #'car)) 
;; #t

```

Does the `#'car` under the `let` access the same binding?

Thanks.

---

<div class="post-metadata">

**Author:** ![dannypsnl](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dannypsnl/32/917_2.png) [@dannypsnl](https://racket.discourse.group/u/dannypsnl)\
**Post date:** [February 12, 2022, 10:26am UTC](https://racket.discourse.group/t/a-question-about-free-identifier/685/2 "2022-02-12T10:26:09Z")

</div>

Because `#'car` doesn't refer to `car 8` binding

```scheme
(free-identifier=? #'car (let ([car 8]) #'car)) 

```

This program is just

```scheme
(free-identifier=? #'car #'car) 

```

`#'car` will refer to `(define-for-syntax car ...)`

---

<div class="post-metadata">

**Author:** ![chansey97](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chansey97](https://racket.discourse.group/u/chansey97)\
**Post date:** [February 12, 2022, 12:24pm UTC](https://racket.discourse.group/t/a-question-about-free-identifier/685/3 "2022-02-12T12:24:52Z")

</div>

I am watching the video from [CS294: Program Synthesis for Everyone](https://homes.cs.washington.edu/~bodik/ucb/cs294fa12.html). In the screencast of Language implementation (II). The lecturer said those two `#'car` are not equal.

 ![shot0059](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/ffc66c21933832d9d6fab8680141a2a71b5835a2.jpeg)

I am confused about using syntax objects in normal code. Following the lecturer, syntax objects contain source code location and lexical binding information. Does it mean that it can be used in normal code?

For example,

```scheme
(free-identifier=? #'car (let ([car 8]) #'car)) 

```

Can the rightmost `#'car` have lexical binding information of `car 8`?

PS. I just upload the video to [youtube](https://youtu.be/7z3Xl--ONko) (see 4:12). If there is some license issue, I can delete it.

---

<div class="post-metadata">

**Author:** ![sorawee](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sorawee](https://racket.discourse.group/u/sorawee)\
**Post date:** [February 12, 2022, 12:40pm UTC](https://racket.discourse.group/t/a-question-about-free-identifier/685/4 "2022-02-12T12:40:35Z")

</div>

That's the behavior of the old macro expander. See [https://www.cs.utah.edu/plt/scope-sets/general-macros.html](https://www.cs.utah.edu/plt/scope-sets/general-macros.html) for details.

---

<div class="post-metadata">

**Author:** ![chansey97](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chansey97](https://racket.discourse.group/u/chansey97)\
**Post date:** [February 13, 2022, 11:07pm UTC](https://racket.discourse.group/t/a-question-about-free-identifier/685/5 "2022-02-13T23:07:43Z")

</div>

Thanks.

It seems that the scope of rightmost `#'car` in `(free-identifier=? #'car (let ([car 8]) #'car)) ` has been discarded in new version. I am not clear why to do this though.

The old behavior seems to be regained by `(quote-syntax car #:local)`.

```scheme
(free-identifier=? (quote-syntax car #:local) (let ([car 8]) (quote-syntax car #:local))) 
;; #f

```

Does this mean that `#:local` is just to be compatible with the old version?

I also noticed that the program in the question returns `#f` in Chez Scheme 9.5.2,

```scheme
(free-identifier=? #'car (let ([car 8]) #'car))
;; #f

```

To understand the difference, it seems necessary to read the entire history of Racke/Scheme macro system.

---

<div class="post-metadata">

**Author:** ![chansey97](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@chansey97](https://racket.discourse.group/u/chansey97)\
**Post date:** [February 13, 2022, 11:28pm UTC](https://racket.discourse.group/t/a-question-about-free-identifier/685/6 "2022-02-13T23:28:39Z")

</div>

In [the Racket lecture video 19:00](https://youtu.be/ABWLveMNdzg?t=1140), Matthew Flatt said that

> `free-identifier=?` when they have the same biggest subset match for our binding somewhere else.

> `bound-identifier=?` is simply they have the same sets.

For the example of the question,

```scheme
(free-identifier=? #'car (let ([car 8]) #'car)) 

```

These two `#'car` ought to have the same biggest subset, but they have different scope sets. (The left `#'car` has color pink, and the right `#'car` has pink and blue.)

However,

```scheme
(bound-identifier=? #'car (let ([car 8]) #'car))
;; #t

```

still returns `#t`. Perhaps due to discard?
