What does “new” do when called on an erlang module do?

我们两清 提交于 2019-12-22 05:36:51

问题


I've seen module_name:new used in Erlang code, but there is no reference to a "new" function in the module_name module. What does "new" do?


回答1:


It is for "parametrized module": see here and there for more details.




回答2:


        'new'/2 =
    fun (_cor1,_cor0) ->
     apply 'instance'/2
         (_cor1, _cor0)
'instance'/2 =
    fun (_cor1,_cor0) ->
     {'p',_cor1,_cor0}  %%GOTCHA!!!!!

http://www.cnblogs.com/me-sa/archive/2012/02/16/Erlang0037.html



来源:https://stackoverflow.com/questions/2283480/what-does-new-do-when-called-on-an-erlang-module-do

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