A macro is a function that is used to transform (a representation) of
source code. Consequently, it is called when Julia evaluates your
function defintions, not at runtime. Please read
file:///usr/share/doc/julia-doc/html/manual/metaprogramming.html where
you find examples.

Regarding you example: it is unclear what you are trying to do, but
unless you use the macro keyword, you get an ordinary function, not a
macro.

On Sun, Jun 05 2016, Ford O. wrote:

> What makes macro different from function?
>
> Why is it not possible to do:
> foo(e::Expr) = :(&e)
> @foo x = x + 5
>
> On Friday, June 3, 2016 at 10:05:46 AM UTC+2, Ford O. wrote:
>
>  I think this deserves an own topic.
>
>  You should post here syntax that looks like duplicate or you think it could 
> use already existing keyword. (mark with # identical or # replacement)
>  Rule of thumb - the less special syntax the better.
>
>  # identical
>  # replace ' , ' with ' ; ' in arrays ?
>  [1, 2, 3, 4]
>  [1; 2; 3; 4]
>
>  # identical
>  # replace ' = ' with ' in ' in for loops ?
>  for i = 1:10
>  for i in 1:10
>
>  # replacement
>  # replace ' -> ' with ' = ' in anonymous functions ?
>  (a, b, c) -> a + b + c
>  (a, b, c) = a + b + c

Reply via email to