[racket] hygienic read-macros (was: module-level definitions vs. local definitions and how binding works)
Ok that makes sense.
And it explains why this works:
#lang experiment-with-hygenic-reader-extensions-2
(require (only-in "lang/reader.rkt"))
$
Even if I unprovide GENSYM in lang/reader.rkt.
On Jul 29, 2014, at 6:45 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Mon, 28 Jul 2014 23:45:13 -0400, "Alexander D. Knauth" wrote:
>> So since “no-lambda.rkt” doesn’t have to provide lambda for #λ to
>> work, why would you have to provide GENSYM? That’s (part of) what I’m
>> trying to figure out. Why does one work and the other not work?
>
> If I understand, you're asking about the
>
> require: namespace mismatch;
> reference to a module that is not available
> reference phase: 0
> referenced module: ....
>
> error that you get with a GENSYM example, particularly in contrast to
> the absence of that error when referencing `lambda` instead.
>
>
> Normally, you get access to `lambda` to a `require` chain that causes
> the module providing `lambda` to be instantiated along with the module
> that contains the `lambda` reference.
>
> When your reader creates a `lambda` identifier with lexical context,
> things also work out, but only the module providing `lambda` happens to
> be referenced through `require`s from the referencing module, anyway.
>
> No such `require` chain happens to be around to reach the
> implementation of GENSYM when you get the error above. That is, the
> module is unavailable because there was no `require` chain to make it
> available.
>
>
> The disconnect between binding and instantiation is the key problem
> with a reader that produces a syntax object with context. We don't yet
> know how to connect them (at the right phase).
>