Proc(String, Int32)e.g. if it accepts a string an returns an int32
abstract struct Callable end struct Proc1 < Callable def call # define args/return type end end struct Proc2 < Callable def call # define args/return type end end hash = Hash(String, Callable).new
Proc, would need to specify the types of procs that can be in the hash
#getmethod that returns the related
Callableinstance that you could then directly invoke
A macro generates code only in the location in which it is executed.
However.....you can make what you want to do work with macros.
Macros have access to constants.
So, if you generate all of your procs, assigned to a constant name, under a common namespace, then in your main.cr you can iterate over
that namespace (see Crystal::Maros::TypeNode in the Crystal API docs), find the names of all of your Proc constants, and build your master hash.