A similar question was asked Parameterised Modules in Erlang, it is about \"what\". My question is about \"why\"?
OTP Technical Board - Decisions affecting R16 conta
There are other issues as well:
When I write Foo:bar(42)
where Foo
maybe either just a module name or maybe a tuple module but I don't see the difference. This means I might be calling either bar/1
or bar/2
.
I can call the same function in different ways.
It can be difficult to relate errors in functions to the call as the arity is different.
And more. I think it is a shame that we didn't get rid of tuple modules when we got rid of parametrised modules. They were originally just a hacky way of implementing parametrised modules.
I can't tell you what the discussion was within the Great Cabal That Controls Everything, but I can tell you a few reasons why I never have considered using this feature:
It introduces syntactic complexity and semantic abiguity but grants me no new superpowers.
Complexity:
X
of Foo
equal to 10 or 20 right now?"dict:is_key(Value, Thingy)
here and then Thingy:is_key(Value)
over there?dict:is_key(Key, Foo:get_value(Key2))
all the time?"Ambiguity:
This introduces opaque state (bad) instead of an ADT (good, and something we already have).
Foo:is_key(Key)
than dict:is_key(Key, Foo)
. Other than the fact that I am certain on first reading, even in a complete absence of context, that the data object being operated upon in the second version is definitely a dict.Erlang's symbol assignment (aka "single assignment") is great, why destroy that?