[racket] top-level-rename

From: Alexander D. Knauth (alexander at knauth.org)
Date: Tue Aug 12 13:28:28 EDT 2014

Maybe something like this, to make sure it is only changed by a parameterize form?

(provide syntax-local-introduce
         call-with-syntax-introducer)

(define current-syntax-introducer (make-parameter #f))

(define (syntax-local-introduce stx)
  ((current-syntax-introducer) stx))

(define (call-with-syntax-introducer intro thunk)
  (parameterize ([current-syntax-introducer intro]) (thunk)))

On Aug 12, 2014, at 9:47 AM, Gustavo Massaccesi <gustavo at oma.org.ar> wrote:

> +1 . Last year I was experimenting with require-tranformers and
> provide-transformers. They are very weird macros, because they have to
> be executed in the "wrong order" (from inside to outside, like
> functions). They use a newly created syntax-mark, and to break hygiene
> you must use syntax-local-require-introduce or
> syntax-local-provide-introduce (under the hood, the marker is stored
> in a parameter, but the parameter is not exported, so you can't
> change/parameterize it).
> 
> I think that all of them can be merged in a generalized
> syntax-local-introduce with a public parameter. The parameter should
> be used only in a parameterize form. Overwriting the parameter doesn't
> look like a good idea. I think it will break the current macro and
> create a syntax error, but it will not be useful to break the
> security.
> 
> 
> Gustavo
> 
> 
> On Mon, Aug 11, 2014 at 4:22 PM, Alexander D. Knauth
> <alexander at knauth.org> wrote:
>> 
>> On Aug 11, 2014, at 1:44 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>> 
>>> Answers below, but first a big caution: While these details have been
>>> the same for a while, I hope and expect the representation of syntax
>>> objects to change in the coming months. I have been threatening to
>>> rewrite the macro expander (yes, in Racket) for a while, but things are
>>> lining up so that I can actually start trying soon.
>> 
>> 
>> This is off topic, but if your planning on rewriting the macro expander in Racket, would it be possible to make it so that syntax-local-introduce uses a parameter?
>> That way for match expanders (etc.) it could set that parameter to a new syntax-introducer so that syntax-local-introduce could be used within match-expanders (etc.)?
>> 
>> 
>> 
>> ____________________
>>  Racket Users list:
>>  http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140812/6719f867/attachment.html>

Posted on the users mailing list.