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 29, 2017
1 parent 4c4bbd0 commit c5095d3
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 @@ -583,6 +583,13 @@ above; it passes the tuple `(expr1, expr2, ...)` as one argument to the macro:
@name (expr1, expr2, ...)
```

An alternative way to invoke 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 syntax is 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 c5095d3

Please sign in to comment.