Stratus3D
Stratus3D

Reputation: 4906

Erlang verify that record type exists?

Is there a way to verify that a record of a given type exists in an Erlang module? A function that would work something like this:

=> record_type_exists(robot).
true

Does such a function exist anywhere in Erlang?

Thanks in advance!

Upvotes: 1

Views: 229

Answers (1)

legoscia
legoscia

Reputation: 41578

No, there is no such function.

Records are a compile time feature in Erlang, so whether a record type "exists" or not depends on whether the compiler can find it (in the module itself or in an included header file) when compiling the given module. This is similar to how structs work in C.

Upvotes: 3

Related Questions