From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 3509ABC6C for ; Tue, 5 Feb 2008 16:09:09 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAGQKqEfUnw7UhWdsb2JhbACCNo12AQEBCAQGBwgTB50F X-IronPort-AV: E=Sophos;i="4.25,308,1199660400"; d="scan'208";a="6926246" Received: from ptb-relay01.plus.net ([212.159.14.212]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Feb 2008 16:09:09 +0100 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay01.plus.net with esmtp (Exim) id 1JMPQ4-0004JA-6Q for caml-list@yquem.inria.fr; Tue, 05 Feb 2008 15:09:08 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Variants & structural ordering Date: Tue, 5 Feb 2008 15:04:38 +0000 User-Agent: KMail/1.9.7 References: <20080205081845.2D24D1C02531@mwinf2341.orange.fr> In-Reply-To: <20080205081845.2D24D1C02531@mwinf2341.orange.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200802051504.38263.jon@ffconsultancy.com> X-Plusnet-Relay: c221ccecf808347c1ad8a4a727ed6ebc X-Spam: no; 0.00; variants:01 damien:01 guichard:01 ocaml's:01 haskell's:01 afaict:01 ocaml:01 ocaml's:01 achilles:98 heel:98 grief:98 frog:98 equality:01 polymorphic:01 wrote:01 On Tuesday 05 February 2008 08:21:21 Damien Guichard wrote: > Hi everybody, > > Typically, when you declare: > > type card = > > | Card of int > | Jack > | Queen > | King > | Ace > > ;; > > The relation you wish is: > > Card(2) < ...< Card(10) < Jack < Queen < King < Ace > > And that's what you get when using F#. Comparison is OCaml's achilles heel and this is one (minor) manifestation of that. The ability to develop a program and break a use of polymorphic comparison buried within it without knowing is far more serious and has caused many people untold grief in the past. SML's equality types are a slight improvement but F# and Haskell's solutions are the best way forward AFAICT. OCaml will never be fixed in this sense but, hopefully, a next-generation FPL implementation will solve these problems without sacrificing OCaml's other benefits. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e