I think you're confused about several things.  First, yes a Void is
expected, because that's what a macro definition will yield.

- It is almost always a bad idea to call "eval(parse(...))".  You'd
probably doing something wrong if you ever feel the need to do that.
- "Parse time" is not always "before you run any code".  In your example,
parsing happens when you call the returnMacro method.
- Macros are not like other functions... think of them as "code swappers".
You look at the parsed expression and replace it with another valid
expression.  There's no concept of run-time values or anything else...
you're just swapping code-for-code.

On Tue, Jul 5, 2016 at 11:04 AM, Rangarajan Krishnamoorthy <
[email protected]> wrote:

> Consider this function:
>
> function returnMacro()
>   eval(parse("""
>   macro myMacro(anexpr)
>     parse(anexpr)
>   end
>   """))
> end
>
> I assign the function's result to a variable:
> mymacro = returnMacro()
>
> Then, typeof(mymacro) returns "Void". Is this correct? Because macros are
> parse time entities, wouldn't it be better for "eval" to raise some sort of
> exception?
>
> -Rangarajan
>

Reply via email to