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 02C3FBC48 for ; Wed, 6 Apr 2005 17:15:11 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j36FFAcl021994 for ; Wed, 6 Apr 2005 17:15:10 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA06687 for ; Wed, 6 Apr 2005 17:15:09 +0200 (MET DST) Received: from saul.cis.upenn.edu (SAUL.CIS.upenn.edu [158.130.12.4]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j36FF7Eg021973 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 6 Apr 2005 17:15:09 +0200 Received: from localhost (localhost [127.0.0.1]) by saul.cis.upenn.edu (8.12.10/8.12.9) with ESMTP id j36FF5CP021755; Wed, 6 Apr 2005 11:15:06 -0400 (EDT) Date: Wed, 06 Apr 2005 11:15:05 -0400 (EDT) Message-Id: <20050406.111505.68543084.eijiro_sumii@anet.ne.jp> To: caml-list@inria.fr Cc: sumii@saul.cis.upenn.edu Subject: ambitious proposal: polymorphic arithmetics From: Eijiro Sumii X-Mailer: Mew version 3.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 4253FCFE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4253FCFB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; eijiro:01 sumii:01 eijiro:01 sumii:01 icfp:01 popl:01 integers:01 haskell:01 upenn:01 ...:98 exception:01 polymorphic:01 polymorphic:01 define:01 functions:01 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 once again, Well, I asked the same question many years ago, but I'm afraid I didn't receive satisfactory answers at that time, perhaps because I was just a nameless student.:-) Now that my colleagues and I won the ICFP programming contest twice (as well as organizing it once) and published two POPL papers, I dare to raise the same question again, hoping I'll receive more reasonable responses this time...;-) 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. P.S. I believe I'm not proposing anything as serious as Haskell type classes. -- Eijiro Sumii (http://www.cis.upenn.edu/~sumii/) Department of Computer and Information Science, University of Pennsylvania