Browse thread
[Caml-list] Interfacing C++ and Ocaml
[
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: | Jean-Marc Alliot <alliot@r...> |
| Subject: | Re: Overloading again (Was Re: [Caml-list] Interfacing C++ and Ocaml) |
Brian Rogoff wrote:
> I'd also love to know if and when this will make it into Ocaml since this
> is one of the few things that I dislike about ML style languages and
> even after quite a bit of Caml programming I still miss overloading.
>
Well, I am going to be the black sheep again, but as an old ADA and C++ programmer,
I don't really want to see overloading pop up in ML.
Overloading can become easily a source of mistakes. My favorite example is the
following. A few years ago, I was managing a project with C++ code, and one of the
programmer was using a third party library (the author of this library was gone and
had been replaced). And he had a bug inside the following code fragment in that
library:
toto(titi *initp)
{
titi *p;
for (p=initp;p!=NULL;p++)
{
.......
}
}
And it took him a very long time to realize that the ++ operator had been
overloaded, somewhere in a .h file included in an other .h file, and that instead
of incrmenting the pointer, it was doing something like p=p->next, with a next
field incorrectly initialized somewhere.
Having different names for different functions is, according to me, an excellent
thing.
JMA
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr