Browse thread
[Caml-list] Why are arithmetic functions not polymorph?
[
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: | John Max Skaller <skaller@o...> |
| Subject: | Re: [Caml-list] Why are arithmetic functions not polymorph? |
Brian Hurt wrote: > I don't want to turn this into a C++ > flamefest (had one of those already this week), but in my experience > operator overloading is *really* *really* bad. Not doubt because you had to work on someone else's stupid code. There is a clear an obvious need for overloading aritmetic operators in Ocaml, now it has a reasonably rich set of arithmetic types (including Big_int etc). Another needed overload is 'print' (to print some representation of a value which might be used in a diagnostic). There are fairly obvious rules about not *overusing* a facility. C++ programmers, alas, are prone to stretching the meager technology available to them to the limit. One comment I read on Slash.dot (or was it Freshmeat) about Ocaml was who ugly it was to write print_endline (string_of_int i) compared to cout << i << endl; To be truthful such longwindedness often obscures my program logic: the case they make isn't really sound, but it is not entirely stupid either. Of course, there is a distinction between convenience (+ for all arithmetic types), and dependence (dependent name lookup in templates). The later is an abuse the *forces* complex overloads to be defined (so that templates work). -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- 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