On 28-07-2012 09:36, Stuart wrote:
On Friday, 27 July 2012 at 21:59:33 UTC, Paulo Pinto wrote:
On Friday, 27 July 2012 at 19:14:29 UTC, Stuart wrote:
On Friday, 27 July 2012 at 19:09:27 UTC, Paulo Pinto wrote:
On Friday, 27 July 2012 at 19:04:07 UTC, Stuart wrote:
Recursion isn't just a security risk - it's a performance hit as well.
Only in languages without tail call optimizations.
Which is pretty much all of them.
Scheme does it, and probably HOPE too; but bugger-all you could write
a real program in, like .NET or C++. I mean, we're in bloody FORTRAN
territory here. What use is that for writing Windows applications?
Does D have tail call optimisation?
Well, at least all of these:
- Scheme
- Haskell
- OCaml
- F#
- Erlang
- Clojure
- Some C and C++ compilers (gcc, Intel, MSVC in release mode)
- Most commercial Lisp compilers
So, as I said, nothing you can write a real program in - except possibly
for F#. The possibility of "some" C compilers supporting it doesn't mean
you can rely on the feature being present.
Are you serious........?
Yes D compilers also do tail call optimizations in certain cases, even
if not specified in the language spec
If it's not specified in the language spec - and if it's only "in
certain cases" - how can you rely on it?
You can't.
--
Alex Rønne Petersen
a...@lycus.org
http://lycus.org