cmsjr
cmsjr

Reputation: 59225

What is ?MODULE

I am working through the tutorial here

http://alexmarandon.com/articles/mochiweb_tutorial/

One of the source files contains

start(Options) ->
    {DocRoot, Options1} = get_option(docroot, Options),
    Loop = fun (Req) ->
                   ?MODULE:loop(Req, DocRoot)
           end,
    mochiweb_http:start([{name, ?MODULE}, {loop, Loop} | Options1]).

What does ?MODULE denote?

Upvotes: 2

Views: 140

Answers (1)

xin zhao
xin zhao

Reputation: 619

?MODULE is one of predefined macros in Erlang and it expands into the name of the current module as an atom.

http://erlang.org/doc/reference_manual/macros.html#id84790

Upvotes: 7

Related Questions