A sort of inheritance for struct?

Thanks @minhajuddin, this was also my idea. I posted my question to discover any alternatives (if there are any).
So far, the only solutions that I can think of are:

  • copy pasting the Post defstruct (and @type and doc) as many times as there are subtypes
  • Going the Plug.Conn way: declare all properties of the subtypes in the Post type
  • defining the N types and use a macro to avoid copy pasting

If there is another approach, I’d be curious to know about it. A more experienced functional programmer could certainly explain how to approach this problem.