[racket] arrows in macro stepper
Thanks a lot Ryan for the explanation,
-- Éric
On Jun 10, 2010, at 11:46 AM, Ryan Culpepper wrote:
> Eric Tanter wrote:
>> Hi,
>> A simple question: what exactly are those arrows with question mark
>> in the macro stepper? (see picture below) I noticed that they seem to
>> appear only if there is an occurrence of the same identifier with a
>> different color in between (ie. in the example below, if (display it)
>> is not there, then the second arrow is blue, and without question
>> mark).
>> I couldn't find a precise explanation in the guide.
>
> The blue arrows indicate "definite" references and the purple arrows indicate "apparent" references. A reference is definite when it lies in the exapnded part of the program. In the unexpanded part of the program (approximately, the part after the redex), things that look like references might be changed by intervening macros. They might become binding occurrences themselves, or expansion might uncover a binding closer than the one apparent before expansion starts.
>
> To illustrate, run the following program in the macro stepper:
>
> #lang racket
> (define (x)
> (cons x
> (let ([x 1])
> (cons x
> (let ([x 2])
> x)))))
>
> Set the macro hiding policy to "Custom"; click any occurrence of 'let' in the program and click "Show macro". At first, all of x's seem to refer to the module-level binding, but as macro expansion progresses it discovers the binding structure. Some purple arrows turn blue and others disappear as new bindings are uncovered.
>
> Check Syntax also has purple arrows that point into syntax constants (eg, macro templates). They mean roughly the same thing: who knows how apparent references in the syntax will eventually turn out?
>
> Ryan