What about Code.ensure_loaded/1 <https://hexdocs.pm/elixir/Code.html#ensure_loaded/1> and Code.ensure_compiled/1 <https://hexdocs.pm/elixir/Code.html#ensure_compiled/1>? They even have versions ending in "?" that just return true/false.
Em sábado, 24 de fevereiro de 2018 22:49:40 UTC-4, [email protected] escreveu: > > It is more difficult than you would expect to check if something in Elixir > is a module. I think it is fairly reasonable to build this functionality > into the language. The best way I've found to do this is to call a function > on the value and rescue from the `UndefinedFunctionError`. This feels a bit > hacky to me and I think there should be a more elegant solution. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/d60e7665-f854-429f-89c6-dd2d09c791a9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
