[
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: | Brian Hurt <bhurt@j...> |
| Subject: | Re: [Caml-list] tail rec |
Robert Fischer wrote: > >> I'm repeating my suggestion: extend the typing annotation (produced >> by -dtypes) to flag every tail recursive call, and have the emacs >> mode and ocamlbrowser display every tail call particularily (e.g. in >> a different color or font). >> >> This don't require any additional language construct. >> > > Oh, then we're cool. :-D > >> Also, tail recursion is IMHO a beginner's puzzle. I'm pretty sure >> every experimented Ocaml programmer does know inside his code what >> are his tail recursive calls. >> > > If you asked me to point them out, I could. If you asked me if a > given function is tail recursive, I could tell you. I also use tail > recursive calls unintentionally, and (while I realize now that you're > not proposing this) I was concerned my code suddenly wouldn't compile > because I didn't happen to tag a tail recursion. Most of the time you don't care wether a particular call is a tail call or not. I will comment: in my experience, new programmers make simple mistakes for simple reasons, while experienced programmers make simple mistakes for complicated reasons. Actually, I can see uses for this, even for experienced, knowlegable programmers. For example, I can imagine scenarios where, during maintainance, a try/catch block is introduced, making a tail call that needed to be a tail call into a non-tail call. Opps. I don't think this happens all that often, so it's not that valuable to experienced programmers, but every little bit of correctness helps. Brian