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 <https://github.com/Qqwy/elixir-type_check/blob/21d5de5a1979ebd10d0f30818b6e837062027269/lib/type_check/internals/pre_expander.ex#L265-L270>)*
There was no information in Elixir's documentation about this. Looking at the source of `defstruct` <https://github.com/elixir-lang/elixir/blob/79cd891eb86ecb7654a7acdb63769cfdd950a5c0/lib/elixir/lib/kernel.ex#L5037-L5046> 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 -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/0073f752-0c18-4c7e-a697-3ab17601a9d8n%40googlegroups.com.