Using __MODULE__ in protocol implementation

Hi all,

when I am trying to use __MODULE__ alias in protocol implementation (functions inside the defimpl block), it’s complaining, that <MyProtocol>.<MyModule>.__struct__ is undefined, cannot expand struct.

Should I use the literal name of the module everywhere or is there some better approach for DRYing the code?

Thanks. :slight_smile:

There are the @protocol and @for module attributes. :slight_smile:

5 Likes

Oh, perfect, thank you @josevalim :slight_smile: