I am studying how macros are defined/called with keyword parameters.
Looking first at
if – I thought that “maybe”
else were “just regular keywords.”
Then I thought: Maybe
do is special and
else is not?
Now I think maybe they’re both special?
I made an
if2 which works fine:
defmacro if2(condition, do: do_block, else: else_block) do quote do case unquote(condition) do x when x in [false, nil] -> unquote(else_block) _ -> unquote(do_block) end end end
But… if i change the definition (and the call) from
otherwise, it doesn’t work.
Can someone explain? Is the parser treating this macro specially somehow?