What does "new" do when called on an erlang module do?
I've seen module_name:new used in Erlang code, but there is no reference to a "ne开发者_运维问答w" function in the module_name module. What does "new" do?
It is for "parametrized module": see here and there for more details.
'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
精彩评论