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 OAA31985; Sun, 10 Feb 2002 14:55:50 +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 OAA32560 for ; Sun, 10 Feb 2002 14:55:49 +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 g1ADtnD20900 for ; Sun, 10 Feb 2002 14:55:49 +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 9511816A0 for ; Sun, 10 Feb 2002 14:55:47 +0100 (CET) Message-ID: <00b401c1b23a$03ae0cb0$0700a8c0@warp> From: "Warp" To: "OCaml" References: <006801c1b233$83825ec0$0700a8c0@warp> <20020210144020.A29539@osiris.net-nono.com> Subject: Re: [Caml-list] Suggestion for overloaded operators Date: Sun, 10 Feb 2002 14:51:17 +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 > Hello, > > what about polymorphism ? > > assume following declarations : > > let (:+) x y = x + y > let (:+) x y = x +. y > > we define the overloaded operator :+ (respectively for int and for float) here, you can't do that because :+ is not an operator. let int_add_int x y = x + y let float_add_float x y = x +. y > what about the following declaration : > > let f x y = x :+ y ;; f : 'a -> 'b -> 'c and assume that a function called typea_add_typeb exists and returns a 'c type. > Is f overloaded too ? f has not the colon symbol ! > Is this declaration forbidden ? why ! > > I think that overloading is not compatible with type inference ? I don't know, but this thread should answer to that question. 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