Hi all!
I recently needed to check what fields for a struct were defined (if any) for a particular module, at compile-time (potentially in the body of that module, i.e. while the module was still 'open').
(for the curious, it's part of code that builds a runtime type-check from a typespec, see here)
There was no information in Elixir's documentation about this. Looking at the
source of `defstruct` we however find that it defines a `@__struct__` module attribute (which is then later on used to implement the introspection method `__struct__/0`).
Now the question is: Is it OK for libraries to depend on `@__struct__` or should it be considered an implementation detail which is subject to change?
-If it's OK: Should we maybe add a sentence to the module documentation of `Module`? Or the documentation of `Kernel.SpecialForms.%/2`?
- If it's not: Is there a 'proper' way to obtain this information for an 'open' module instead?
Thank you all,
~Marten/Qqwy