>
> Yup, implicit return works for macros, too.  The manual makes it explicit
> to emphasize the function-like syntax transformation (as opposed to
> CPP-like textual substitution).


Just to follow up on this a bit: we've continually reworked the
metaprogramming documentation because it can be an especially difficult
concept for people who don't have a compiler background or Lisp experience.
The most common sources of misunderstanding have been rooted in people not
internalizing that macros, from a definition standpoint, are just functions
that return expressions. A lot of questions on the mailing list treated
macros as "spooky magic" (I'll admit to feeling this way for a long time!).
We want to make them less so. Showing explicit returns, and emphasizing
macros as transformations first, was an attempt to reduce the level of
implicit knowledge required to understand what is happening.

On Wed, Apr 20, 2016 at 9:50 AM, Matt Bauman <[email protected]> wrote:

> On Wednesday, April 20, 2016 at 8:58:35 AM UTC-4, Didier Verna wrote:
>>
>>
>>   What's the rationale behind this particular way of invoking macros
>>   (the @ character) ?
>
>
> It's nice for both humans (it's obvious that there could be some
> non-standard evaluation semantics or other such funniness) and the parser
> (it knows exactly which symbols it needs to resolve in order to expand the
> macros since nothing else can contain the @ character).
>
>
>> And why a single macro concept for two different
>>   things (with or without arguments) ?
>>
>
> Are you talking about the optional parentheses?  That is: `@m(x,y)` vs `@m
> x y`?  It's very convenient to have the parentheses-less version for macros
> like @inline and @simd which annotate or transform existing structures.
> And parentheses with comma-separated arguments can be nice in cases where
> the distinction between several arguments might get fuzzy otherwise.
>
> On Wednesday, April 20, 2016 at 9:19:03 AM UTC-4, Didier Verna wrote:
>>
>>  Also, I'm wondering about the use of RETURN in all the one-liner
>>     macro examples from the manual.
>
>
> Yup, implicit return works for macros, too.  The manual makes it explicit
> to emphasize the function-like syntax transformation (as opposed to
> CPP-like textual substitution).
>

Reply via email to