Skip to content

Commit

Permalink
Add docs to feature of juxtaposition of macros and arrays
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
cdsousa committed Sep 2, 2017
1 parent 9f01be6 commit 4b776b8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/src/manual/metaprogramming.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,13 @@ above; it passes the tuple `(expr1, expr2, ...)` as one argument to the macro:
@name (expr1, expr2, ...)
```

An alternative way to call a macro over an array literal (or comprehension) is to juxtapose both without using parentheses. In this case, the array will be the only expression fed to the macro. The following syntaxes are equivalent (and different from `@name [a b] * v`):

```julia
@name[a b] * v
@name([a b]) * v
```

It is important to emphasize that macros receive their arguments as expressions, literals, or
symbols. One way to explore macro arguments is to call the [`show()`](@ref) function within the
macro body:
Expand Down

0 comments on commit 4b776b8

Please sign in to comment.