[erlang-questions] What is the function be defined as BIF?
LUKE
luke@REDACTED
Tue Nov 27 08:17:49 CET 2007
I found that i lose some word in the code.
start(Name,Mod)->register(Name,spawn(fun()->loop(Name,Mod,Mod:init()) end)).
But
Why the code can be compile?
start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) end)).
----- Original Message -----
From: LUKE
To: erlang-questions@REDACTED
Sent: Tuesday, November 27, 2007 2:50 PM
Subject: What is the function be defined as BIF?
-module(genserver).
-export([start/2,rpc/2]).
start(Name,Mod)->register(spawn(fun()->loop(Name,Mod,Mod:init()) end)).
....
Eshell V5.5.5 (abort with ^G)
...
9>c(genserver).
./genserver.erl:4: function register/1 undefined
--
modify the register to erlang:register
start(Name,Mod)->erlang:register(spawn(fun()->loop(Name,Mod,Mod:init()) end)).
--
10> c(genserver).
{ok,genserver}
The register function is BIF ?
And the spawn function is BIF?
All of erlang:* is BIF?
When we need specify a prefix erlang:* ?
Why the most of example does not using erlang:register?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071127/82452681/attachment.htm>
More information about the erlang-questions
mailing list