Browse thread
[Caml-list] Does Caml have slow arithmetics ?
-
Diego Olivier Fernandez Pons
- Richard Jones
-
Basile Starynkevitch [local]
- Diego Olivier Fernandez Pons
-
Evgeny Chukreev
-
Xavier Leroy
- Evgeny Chukreev
-
skaller
- David Brown
- Alex Baretta
- Jon Harrop
-
Xavier Leroy
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Andreas Rossberg <rossberg@p...> |
| Subject: | Re: [Caml-list] Does Caml have slow arithmetics ? |
David Brown wrote: > > In some functional languages (Scheme, specifically), tail recursion is > required to be implemented iteratively. It is a common enough idiom, > and easy enough to implement, that it is generally done in functional > languages. In fact, gcc does it in C, with enough optimization. The latter is, to a certain extent, a myth. First, you have to distinguish between simple tail *recursion*, and the much more general concept of tail *call*. I believe Scheme requires to fully optimize the latter, and so it is done by all decent FPL implementations. GCC does not do that, already falling short of mutually recursive functions, IIRC. Second, a C compiler can only optimize tail recursion under limited circumstances, because generally the C language semantics prevent it (once more due to pointers, particularly C allowing - and its libraries relying on - taking the address of local variables). Last time I heard of it, it was said that GCC is having a hard time doing anything practically usefull at all. - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de Let's get rid of those possible thingies! -- TB ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners