From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id FAA02402; Tue, 3 Jun 2003 05:25:39 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id FAA02333 for ; Tue, 3 Jun 2003 05:25:37 +0200 (MET DST) Received: from mail1.tpgi.com.au (mail.tpgi.com.au [203.12.160.57]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h533PZT20242 for ; Tue, 3 Jun 2003 05:25:36 +0200 (MET DST) Received: from ozemail.com.au (203-219-225-76-syd-ts24-2600.tpgi.com.au [203.219.225.76]) (authenticated (0 bits)) by mail1.tpgi.com.au (8.11.6/8.11.6) with ESMTP id h533PX401796 for ; Tue, 3 Jun 2003 13:25:33 +1000 Message-ID: <3EDC152C.5070906@ozemail.com.au> Date: Tue, 03 Jun 2003 13:25:32 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: "caml-list@inria.fr" Subject: Re: [Caml-list] Why are arithmetic functions not polymorph? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ozemail:01 caml-list:01 flamefest:01 stupid:01 alas:01 freshmeat:01 endline:01 endl:01 toxteth:01 glebe:01 2037,:01 9660:01 0850:01 ocaml:01 overloading:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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