Le lundi 30 janvier 2017 06:25:29 UTC+1, Matias Eyzaguirre a écrit :
> Nice, thanks! I wasn’t aware of that. so macros are expanded in the order 
> that the reader reads them, not in so called evaluation order.

>From experience, the order is outside-in, each form after the preceding one 
>(except when a macro produces a begin form, in which case the contents of the 
>begin are spliced, and handled one by one). The contents of let-values forms 
>are initially skipped, and expanded after every form in the outer let has been 
>expanded enough to determine that it is not a definition. This means that 
>within the body of a let (or of a module, I think), forms are expanded until 
>the first element is not a macro anymore (e.g. a function application with 
>#%app, an expression with #%expression, or a datum), as any remaining macro 
>could potentially expand to a definition.

Add to that a few exceptions, like things lifted with 
syntax-local-lift-expression or syntax-local-lift-module-end-declaration, and 
explicit expansion with local-expand.

I wonder if there's a definitive reference in the docs about this? I'd enjoy 
reading about how the built-in forms behave, and what mechanisms may influence 
the order of expansion (#%expression, local-expand, maybe some others?).

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to