On Mon, May 2, 2016 at 7:34 PM, Matthew Butterick <[email protected]> wrote:
>> On May 2, 2016, at 11:50 AM, Sam Tobin-Hochstadt <[email protected]> 
>> wrote:
>>>
>>> My initial statement was less precise than my second email.
>>> `(syntax-local-introduce stx)` adds a single scope, using the
>>> equivalent of `'flip` mode. That scope is "the current scope" for the
>>> macro expansion step.
>
> I appreciate your more detailed explanation.
>
> The common thread in the Knauth/Butterick critique is that 
> `syntax-local-introduce` promises a result — syntax, locally introduced — but 
> in fact delivers a certain action — adding a scope — that will only achieve 
> the promised result if a certain other criterion is met (namely, a 
> context-free syntax object). This is not apparent from the docs (though I 
> will prepare a pull request to make it so).

I don't understand what the critique is supposed to be. Are you saying
that the name is misleading? Or that it should do something different?
Or just that the docs need clarifying?

> Even with this clarification, some puzzling behavior awaits. For instance, 
> you are correct that using `(datum->syntax #f 'x)` makes my two original 
> examples work. But consider example #3 — where a subsequent local definition 
> will shadow the `syntax-local-introduce` identifier, without an error — and 
> example #4, which reverses the order of the two binding expressions, which 
> then triggers an ambiguous-binding error.

What's going on here is the complexities of internal definition
contexts, and the scopes that they add. In Example #3, there's an
extra scope for the locally-defined x, which is applied to the x
reference, meaning that it has one more scope that the introduced
binding doesn't have, so the x matches it.

Strangely, your Example #4 works the same as example #3, except in
DrRacket, where it errors.

Sam

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to