Macros question

Hello, I am working on Shrine implementation for Crystal (

Currently my biggest problem is a plugin system. I tried to implement it with macros and everything was good until I tried to inherit plugins list from a superclass.

Here is an example

As far as I understand {{@type.superclass.constant(:PLUGINS)}} should return Array of plugins for C class, but it is blank…

1 Like

/cc @Blacksmoke16

You do:

PLUGINS << plugin

and that happens at runtime.

You need to do:

{% PLUGINS << plugin %}

(without the resolve bit)

and then it will work.

I also recommend removing everything unnecessary to demostrante a problem or question. There’s InstanceMethods and many other things that are not relevant to the question, and at least in me it caused an effect of “this is too much code, I’ll skip helping” (well, then I did it anyway, but with less code there’s more change to get help).


Finally, I get it to work!


  • Inheritance of plugins from base class
  • Protection from loading same plugin several times