问题
I ask this question as I have noticed that alot of OpenSource Erlang projects use "new" to pass parameters to Erlang modules, yet I hear at the same time that "new" is not part of the official language and may not be supported if it contains bugs. Before I use it in my own project I would like to clarify this issue.
Update: I have since asked on the official Erlang mailing list for an answer:
http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:49535:201002:aicfhmngkhodmclhlnak
回答1:
There is no official Erlang standard, that makes it difficult to be part of it.
The OTP/Erlang team seem to only consider features as official if they have documented them. Parameterized modules (that is the feature's name) is not documented. What the OTP/Erlang team decide to do is as close to an Erlang standard as we have.
Personally I don't see the attraction to make Erlang appear like something it is not. It only makes the language have more rules to know and teach, and it only leads to disappointment from those that expect everything to be like their past OO background. It is not powerful to add complexity.
Implementation-wise (an abstraction that many exploit) the parameterized module is currently just a tuple of the module name and the parameterized module's "instance variables". So it is just an external function call that hide a few of the parameters.
来源:https://stackoverflow.com/questions/2287403/is-new-in-erlang-part-of-the-official-standard-and-should-we-use-it