Erlang article #1 on

Logan, Martin Martin.Logan@REDACTED
Thu Aug 17 21:43:34 CEST 2006

Rick, you are correct but technically the process loops in Erlang are
implemented via tail recursion.  I think this is where the
misunderstanding came about.  Procedural looping structures such as
"for", "while", "do while", and "foreach" are the sorts of looping
constructs that would severely damage Erlang as a language, IMHO.


-----Original Message-----
From: owner-erlang-questions@REDACTED
[mailto:owner-erlang-questions@REDACTED] On Behalf Of Rick Pettit
Sent: Thursday, August 17, 2006 1:50 PM
To: Ryan Rawson
Cc: Joel Reymont; Yariv Sadan; erlangquestions
Subject: Re: Erlang article #1 on

On Thu, Aug 17, 2006 at 11:30:19AM -0700, Ryan Rawson wrote:
> Surely you jest?
> You'd have to break Erlang to insert loops.  First off you'd have
> variables that need to be changed.  That substantiably breaks Erlang
> imho.

Not sure I understand you here. I have recently been using Joe
robust TCP server, for example, and in that there is the notion of a
"controller" loop for synchronizing operations among multiple socket

For "simple servers" (i.e. those not requiring a behaviour like
I see tail-recursive server loop constructs all the time.

Single assignment isn't a problem considering each new iteration through
loop allows for new local variable bindings, etc.

> If you want to loop, you probably want to map or fold.  If you need to
> loop you might want to use gen_server instead, or at the last resort
> use a tail recursive call.

What do you think goes on behind the scenes in a map, fold, or even

You might be surprised to find that there is a server loop in a
(it is what passes the state to gen_server callbacks, and it is what the
gen_server callbacks return the state to).

Perhaps I misunderstand you.


> On 8/17/06, Joel Reymont <joelr1@REDACTED> wrote:
> >
> >On Aug 17, 2006, at 5:53 PM, Ryan Rawson wrote:
> >
> >> I beg of all of you - no for loops.  No looping of any kind!
> >
> >What's wrong with looping?
> >
> >--
> >
> >
> >
> >
> >
> >
> >

More information about the erlang-questions mailing list