Is “new” in Erlang part of the official standard and should we use it?

£可爱£侵袭症+ 提交于 2019-12-23 20:28:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!