[erlang-questions] is there something like #line

datacompboy datacompboy@REDACTED
Sat Jun 2 17:32:05 CEST 2007

Guest wrote:
Bjorn Gustavsson wrote:

(end of quote)

for handle_call, handle_info, handle_cast, put actual handlers into separate functions. so your server will consist of 3 parts:

  % public
  action(X) -> gen_server:call(?MODULE, {action, X}).
  % actions
  do_action(X) -> io:format("I'm do ~p, do you know?!~n", [X]).
  % handler
  handle_call(.., {action, X}, ..) -> {reply, do_action(X)},

before real actions you can easy insert -file().

mine two cents about "why <<;>>, <<.>> and <<together>>":
(note about SHOULD and MUST as in RFC).
  1st: usability. when you have all code for one fun in one place, you see all clauses near. you SHOULD separate fun to several, if you fun take more that one screen. (exception -- loong case list, like action callers. but looong case list SHOULD be only callers to action funs, that, of course, should fit into one screen).
  2nd: order of preference. when you have all parts together, you able to write:
myfun(0,_) -> 0;
myfun(_,0) -> 1.
  and know that on call myfun(0,0) you get 0, not 1. again -- as they close, you see that order. if you have 1st clause in start of file, and 2nd in end -- you will not sure...
  3rd: ; and . -- that 1st: strict you to writing close, 2nd: allow to find misstype like definition support fun with same count of arguments; 3rd: make unify syntax for <function> cases and <if> cases.
--- suicide proc near\n call death\n suicide endp
Post sent from http://www.trapexit.org

More information about the erlang-questions mailing list