[erlang-questions] The Beauty of Erlang Syntax

Zvi exta7@REDACTED
Thu Feb 26 19:48:11 CET 2009

Tony Arcieri wrote:
> Reia also has ! (send) and receive which operate identically to Erlang,
> but
> in addition to that supports the obj.method syntax as syntactic sugar for
> RPCs.  At the very least it's less ugly than Scala's !? operator for RPCs.

I disappointed, that you support regular Erlang processes in Reia.
Functionality-wide you don't need it, since every Reia object is already
process (off-course it's heavyweight gen_server process). Whoever want to
write efficient code (may use assembler - i.e. Erlang :)

All I say, that in high-level language you need gen_server like
functionality on the language layer. In Erlang you end up writing
boilerplate code for gen_servers. The current Erlang provide you with FS
(Flexibility Syndrom). Even such a basic thing like a string: you can use
list, you can use binary and some library functions even accept atoms
instead of strings.
Look for example at Ulf Wiger's plainfsm vs. gen_fsm . There is overlapping
between plain Erlang and OTP. The good thing, that there is only one OTP
(i.e. no competing high-level frameworks for Erlang).

I want to concentrate on my problem domain and think in single paradigm.
Instead erlang forces you to think in MFAs, funs, messages and gen_server

Having both regular functions and funs is also FS (I understand that
historically funs were introduced later, but still). I see regular function
as constant fun.

Regaring simple things in other languages - hard in Erlang. This was
discussed many times and I'll not repeat it: interop, strings, collections,
defining functions from shell, libraries with principle of maximum surprise,
etc. I'll just give simple example like loop:

10.times { puts "hi" }

for i=1 to 10
  print "hi"


print_hi(0) -> ok;
print_hi(N) ->

or use LC, which is a little shorter, but build 2 unnecessary lists in

[ io:format("hi~n") || _<-lists:seq(1,10) ].

or try to define factorial fun from shell:

Fact = fun(0,_) -> 1;
              (N,F) -> (N-1)*F(N,F)
Fact2 = fun(N) -> Fact(N, Fact) end.



View this message in context: http://www.nabble.com/The-Beauty-of-Erlang-Syntax-tp22179816p22230905.html
Sent from the Erlang Questions mailing list archive at Nabble.com.

More information about the erlang-questions mailing list