[erlang-questions] ?DATE and ?TIME MACROs

Richard Carlsson richardc@REDACTED
Tue Oct 7 16:19:04 CEST 2008

Mats Cronqvist wrote:
>  afaik, no. it's just a regular exported function that would look 
> something like this in Erlang.
> module_info() -> <list of tagged tuples>.
> module_info(Tag) ->
>  try proplists:get_value(Tag,module_info())
>  catch _:_ -> exit(badarg)
>  end.
>  where <list of tagged tuples> is a constant term.
>  this is just speculation on my part though.

That used to be true, but these days they are simply
wrappers around a couple of built-in (undocumented?)
functions, like this:

module_info() -> erlang:get_module_info(?MODULE).
module_info(Tag) -> erlang:get_module_info(?MODULE, Tag).

(Since the metadata is already loaded from a chunk in the
beam file, there is no need to duplicate it in the code.)

But the compiler inserts the functions, yes.


More information about the erlang-questions mailing list