multiple waiting gen_tcp:accepts

matthias <>
Sat Jul 21 22:12:08 CEST 2001


 > "get_func()" below returns a function. Immediatly calling 
 > "get_func()(3)" gives a syntax error, while "A = get_func(), A(3)" 
 > behaves ok. What's the reason for that? I guess it has to do with that 
 > funs are a late addition to Erlang, and the syntax parser didn't have to 
 > deal with double brackets - "...(..)(..)" - before that?

The grammar (see E2 in
http://www.erlang.org/download/erl_spec47.ps.gz) does allow

  (get_func())(3)

so at least the grammar agrees with reality. As to why it's that way,
I don't know. Maybe it's a bit like asking 'why isn't there any
currying'. There just isn't.

Matthias



More information about the erlang-questions mailing list