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 OAA30839; Sun, 10 Feb 2002 14:09:18 +0100 (MET) 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 OAA19015 for ; Sun, 10 Feb 2002 14:09:17 +0100 (MET) Received: from relay-3v.club-internet.fr (relay-3v.club-internet.fr [194.158.96.114]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g1AD9HD20564 for ; Sun, 10 Feb 2002 14:09:17 +0100 (MET) Received: from warp (lns03v-6-178.w.club-internet.fr [212.194.41.178]) by relay-3v.club-internet.fr (Postfix) with SMTP id 4FF1616C1 for ; Sun, 10 Feb 2002 14:09:15 +0100 (CET) Message-ID: <006801c1b233$83825ec0$0700a8c0@warp> From: "Warp" To: "OCaml" Subject: [Caml-list] Suggestion for overloaded operators Date: Sun, 10 Feb 2002 14:04:45 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Helo. One of missing thing in Ocaml is the possibility to overload the operators such as + - / * = (by overloading, i mean : defining such operators for other types than -int- ).... Here's a syntactic proposal to enable this feature : (a :+ b) The ':' is here to precise that we're using overloading , and a and b can be of any type. ( let's say typea and typeb ) The compiler will seek for a function named : typea_add_typeb : typea -> typeb -> typer and use it to implement the :+ operator. ( which have typer as result type ) And so on... I think such a thing cannot be done with CamlP4 - because it doesn't know about types - and I know that the ocaml team has lots of things to do , but I was thinking that can be a quite good feature for futur updates. Warp ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr