[erlang-questions] question about Variable:fun()

Mikael Pettersson mikpe@REDACTED
Mon Jun 27 09:48:54 CEST 2011


On Mon, 27 Jun 2011 14:37:44 +0800, "Andy W. Song" <wsongcn@REDACTED> wrote:
> I guess I found the answer, see following code
> -module(abc).
> -export([joke/0, test_fun/1]).
> 
> test_fun({abc, _, _}) ->
>     io:format("Great, ~n").
> 
> joke() ->
>     V = {abc, "tst", "filed2"},
>     V:test_fun().
> 
> If I call abc:joke() it will eventaully call test_fun/1, with V as the
> parameter. I would like to see some official documentation though.

The V call looks like a fake parameterized module.  They should
be documented, perhaps as an experimental extension, however the
specific usage with an explicit tuple doesn't look quite kosher.



More information about the erlang-questions mailing list