From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id B2DD4BC84 for ; Wed, 6 Apr 2005 17:51:25 +0200 (CEST) Received: from relay-bv.club-internet.fr (relay-bv.club-internet.fr [194.158.96.102]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j36FpPnk028927 for ; Wed, 6 Apr 2005 17:51:25 +0200 Received: from Galois (l10v-4-165.d2.club-internet.fr [62.34.27.165]) by relay-bv.club-internet.fr (Postfix) with ESMTP id 4572025638; Wed, 6 Apr 2005 17:51:25 +0200 (CEST) Received: from evariste by Galois with local (Exim 4.50) id 1DJCoO-0003r4-K1; Wed, 06 Apr 2005 17:51:24 +0200 Date: Wed, 6 Apr 2005 17:51:24 +0200 From: =?iso-8859-1?Q?S=E9bastien?= Hinderer To: caml-list@yquem.inria.fr, caml-list@inria.fr Subject: Re: [Caml-list] ambitious proposal: polymorphic arithmetics Message-ID: <20050406155124.GA14809@galois> Mail-Followup-To: caml-list@yquem.inria.fr, caml-list@inria.fr References: <20050406.111505.68543084.eijiro_sumii@anet.ne.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20050406.111505.68543084.eijiro_sumii@anet.ne.jp> X-Miltered: at concorde with ID 4254057D.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ens-lyon:01 caml-list:01 integers:01 compile-time:01 haskell:01 haskell-like:01 exception:01 polymorphic:01 polymorphic:01 define:01 functions:01 tuples:01 caml:02 caml:02 implemented:02 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Hi, > So here it goes: why don't we have polymorphic +, -, etc. while we > have polymorphic =, <, etc.? Many novices and (at least) some experts > feel that +., -., etc. are not quite nice. Why not define +, -, > etc. for as many types as possible such as integers, floating-point > numbers, and tuples? I think they can be implemented almost in the > same efficient way as =. They can also raise an exception if applied > to unsupported values such as functions, just as = does. By the way, why isn't it possible to detect this kind of errors at compile-time ? Isn't the type-system strong enough ? > P.S. I believe I'm not proposing anything as serious as Haskell type > classes. I was wondering if it would be theoretically possible to have Haskell-like type classes in Caml ? If it is possible in theory, is it something Caml developers plan to implement, one day ? Thanks, Sébastien.