proper tail calls

Dave Herman dherman at
Mon Jan 21 16:09:51 PST 2008

Comparing ES4 and Haskell is like comparing apples and orangutans. 
Haskell is a lazy language, where the control flow (and space 
consumption thereof) are far more complex than in a call-by-value 
language like JavaScript or Scheme. It's well-known that tail recursion 
is hard to reason about in Haskell because the accumulation of 
suspensions consumes space in non-local ways, which means that tail 
calls can't simply be determined by inspection of the nesting of 
expressions of a program, but rather by flow-sensitive strictness 
analyses. So this is a totally irrelevant analogy.

As for making it optional, I'll probably repeat this many times: if you 
make proper tail calls optional, you might as well not put them in the 
spec at all. If programmers can't rely on them, they can't use them.


Igor Bukanov wrote:
> On 21/01/2008, Igor Bukanov <igor at> wrote:
>> then I would prefer to make the tail calls an optional optimization
>> in the same way as the type checker is optional.
> And if Haskell language specs can leave the issue of tail call 
> optimization up to implementations, then I do not see why ES4 can not
>  do the same.
>> From :
>> This report defines the syntax for Haskell programs and an informal
>> abstract semantics for the meaning of such programs. We leave as
>> implementation dependent the ways in which Haskell programs are to
>> be manipulated, interpreted, compiled, etc. This includes such
>> issues as the nature of programming environments and the error
>> messages returned for undefined programs (i.e. programs that
>> formally evaluate to _|_).
> Regards, Igor _______________________________________________ 
> Es4-discuss mailing list Es4-discuss at 

More information about the Es4-discuss mailing list