[erlang-questions] maps and lager: how to handle new type gracefully?

Luca Favatella luca.favatella@REDACTED
Tue Apr 29 17:02:18 CEST 2014


Loïc Hoguin wrote:
 > erlang:function_exported(erlang, is_map, 1) can tell you if it exists
before you try to call it.

Max Lapshin wrote:
 > huh, rather complicated, but ok, it will work.

Hi,

I think it doesn't because is_map is a BIF, thus function_exported 
returns false even if the is_map function is there.

 From http://www.erlang.org/doc/man/erlang.html#function_exported-3:
"Returns false for any BIF (functions implemented in C rather than in 
Erlang)."


Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:4:4] [async-threads:10] 
[hipe] [kernel-poll:false]

Eshell V6.0  (abort with ^G)
1> erlang:function_exported(erlang, is_map, 1).
false
2> erlang:is_map(1).
false


Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] 
[async-threads:0] [kernel-poll:false]

Eshell V5.9.3.1  (abort with ^G)
1> erlang:function_exported(erlang, is_map, 1).
false
2> erlang:function_exported(erlang, is_list, 1).
false
3> erlang:is_list(1).
false


Regards
Luca



More information about the erlang-questions mailing list