Reply to Nick,
"bearophile" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
- I know it's not necessary, just as closures aren't necessary in an
OO
language,
because you can create a class every time you may want a closure. But
functional
programmers are used to use certain idioms, such idioms they are part
of
the
functional style of mind (and they are useful because you can build
over
them.
Functional programming is all about building functions using other
functions). If
you want to push some functional-style in D (and I think it's a good
thing) then
several things are necessary (quite useful) to allow such style of
mind
(even if
some of them may look redundant to nonfunctional programmer, like
closures).
This is why I think things tail call elimination and a little may be
useful if D wants
to become more functional.
Maybe I'm just too new to functional programming and tail call
elimination, but I don't see how TCE could be needed for a functional
frame of mind. It's just an optimization, right? And as I understand
it, it just decreases performance hits from function call overhead and
prevents the call stack from growing proportionally to the depth of
recursion (or more simply, it just keeps the size of the call stack
down). Can you provide an example situation where a lack of TCE would
be a problem for a functional programmer?
Some not exactly function programs (Lisp programs that accept user input)
have infinite recursion. Without TCE they will always crash sooner or later,
with it they run just fine.