[erlang-questions] re cursive fun()
Tue Oct 7 04:02:45 CEST 2008
On 6 Oct 2008, at 4:12 am, deepblue_other wrote:
> no shell is not the reason, I need a function that will only be
> called from
> within another function and I dont want to "pollute" the "module
> wide" space
> with another function, so Im putting in a nested one...
This seems an extraordinarily weak reason.
Putting local functions into a namespace that is
designed for local functions is hardly polluting it!
Note that if the 'inner' function is needed in two
clauses of the same function, it cannot be inside
both, so it would have to be at top level anyway.
Somehow, I find myself writing nested functions all
the time in Haskell, but never wanting to in Erlang.
Of course, many functional language compilers implement
nested functions by moving them out to top level anyway...
It's a fundamental property of Erlang scope rules that
there is no letrec.
More information about the erlang-questions