when unicorns is passed to getter macro as a literal form(i don’t know how to call it), what this unicorns is? why class_name return Call, what is this Call stand for? is a Crystal::Macros::Call ? why we call that name?
macro getter(name)
p! {{name}}
end
getter unicorns
will result in:
In 1.cr:5:8
5 | getter unicorns
^-------
Error: undefined local variable or method 'unicorns' for top-level
unlike a method invoke, when a macro is invoking, the arguments for the macro not be context syntactic analysis until the macro is expanded, name replaced by unicorns, then because unicorns method not exists there, so, fallback to report unicorns method not exists on line 5.
But, if change to this, no error happen.
macro getter(name)
p! "{{name}}"
{% debug %}
end
getter unicorns
because "unicorns" is a valid crystal syntax unit, so, no error.
Maybe my describe not correct anyway, please add new answer for clarify.