[erlang-questions] Parameterized module initialization

Richard Carlsson <>
Tue Jun 26 22:40:09 CEST 2012


On 06/26/2012 10:34 PM, José Valim wrote:
> A possible solution, which would also fit well with Richard's static
> proposal, is something along the same lines as Python which requires you
> to explicitly pass *self*:
>
>      some_fun(A, B, self) -> ...
>      some_static_fun(A, B) -> ...
>
> Then the perceived arity is correct and you get static support for free.
> Of course, we cannot use "self" as keyword as Python, but maybe ?SELF or
> another special token will suit well.

No need for a special token; you can use any variable name. The current 
implementation of parameterized modules already binds the name THIS to 
the automatic extra argument.

I always disliked the explicit self-parameter in Python, though. But 
yes, it's an easy cop-out.

    /Richard



More information about the erlang-questions mailing list