What Elixir/OTP version are you running? I'm on OTP 19, Elixir 1.3.2

On Thu, Jul 21, 2016 at 1:32 PM OvermindDL1 <[email protected]> wrote:

> Nope, something is borked for you:
> ```elixir
> iex(12)> :erlang.function_exported(GenEvent.Stream, :module_info, 0)
> true
> ```
>
>
> On Thursday, July 21, 2016 at 12:28:28 PM UTC-6, Theron Boerner wrote:
>
>> True, OvermindDL1's is the way to go unless you need info about the
>> module. Anyone know why this doesn't work?:
>>
>> iex(11)> :erlang.function_exported(GenEvent.Stream, :module_info, 0)
>> false
>>
>> or
>>
>> iex(1)> :erlang.get_module_info(GenEvent.Stream, :module)
>> ** (ArgumentError) argument error
>>     :erlang.get_module_info(GenEvent.Stream, :module)
>>
>> Could it be because it defined a struct?
>>
>> On Thu, Jul 21, 2016 at 1:20 PM OvermindDL1 <[email protected]> wrote:
>>
> That requires dealing with an error and having a try/catch and it is just
>>> a pain.  As I mentioned before, testing if the function `module_info/0`
>>> exists I think is a great way:
>>> ```elixir
>>> iex(9)> :erlang.function_exported(:blah, :module_info, 0)
>>> false
>>> iex(10)> :erlang.function_exported(String, :module_info, 0)
>>> true
>>> ```
>>>
>>>
>>> On Thursday, July 21, 2016 at 12:14:30 PM UTC-6, Theron Boerner wrote:
>>>>
>>>> Use this:
>>>>
>>>> iex(7)> :erlang.get_module_info(String, :module)
>>>> String
>>>> iex(8)> :erlang.get_module_info(:lists, :module)
>>>> :lists
>>>> iex(9)> :erlang.get_module_info(:walrus, :module)
>>>> ** (ArgumentError) argument error
>>>>     :erlang.get_module_info(:walrus, :module)
>>>>
>>>>
>>>>
>>>> On Thursday, July 21, 2016 at 12:20:46 PM UTC-5, ...Paul wrote:
>>>>>
>>>>> Not saying this is a great idea, but I'm working with a pattern where
>>>>> a parameter can be a module or a string.  The gist is:
>>>>>
>>>>> def do_it(data, foo) when is_bitstring(foo), do: data
>>>>> def do_it(data, foo) do
>>>>>   foo.do_other_thing(data)
>>>>> end
>>>>>
>>>>> Works great, but what if I want to allow actual atoms to be used,
>>>>> similar to strings?  How can I identify the difference between an actual
>>>>> atom, like :bar, and a module, like Bar?
>>>>>
>>>>> is_atom() returns true for both cases (makes sense because module
>>>>> names are basically atoms, :"Elixir.Bar")  Is there a way to tell the
>>>>> difference with a guard?
>>>>>
>>>>> If not a guard, some Kernel or Module function?
>>>>>
>>>>> ...Paul
>>>>>
>>>>>
>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "elixir-lang-talk" 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-talk/9fed8269-f58f-4d65-b369-ea6477b2126a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/elixir-lang-talk/9fed8269-f58f-4d65-b369-ea6477b2126a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-talk" 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-talk/4fc5b159-2a35-4eb6-bba2-b97588264aa8%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-talk/4fc5b159-2a35-4eb6-bba2-b97588264aa8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-talk" 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-talk/CAOtk34f9Eh3Hx_OsmaLcKuv8p2c-%2Ba1eJuFOvYpQ%2BKERqHdA8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to