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.8 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 1723BBC6B for ; Sun, 10 Feb 2008 12:58:04 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAFp1rkfUVZgL/2dsb2JhbACmdg X-IronPort-AV: E=Sophos;i="4.25,329,1199660400"; d="scan'208";a="7867861" Received: from hades.snarc.org ([212.85.152.11]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Feb 2008 12:58:06 +0100 Received: by hades.snarc.org (Postfix, from userid 1000) id C0B4E1B482; Sun, 10 Feb 2008 12:58:01 +0100 (CET) Date: Sun, 10 Feb 2008 12:58:01 +0100 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] [OSR] Exceptionless error management, take 2 Message-ID: <20080210115801.GA11897@snarc.org> References: <1202396482.6084.5.camel@Blefuscu> <20080208.001729.233402575.garrigue@math.nagoya-u.ac.jp> <20080208095333.GA582@snarc.org> <200802081907.58290.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200802081907.58290.jon@ffconsultancy.com> X-Warning: Email may contain unsmilyfied humor and/or satire. User-Agent: Mutt/1.5.16 (2007-06-11) From: tab@snarc.org (Vincent Hanquez) X-Spam: no; 0.00; polymorphics:01 polymorphics:01 variants:01 constructors:01 foo:01 polymorphic:01 wrote:01 wrote:01 defines:01 caml-list:01 strings:01 strings:01 variant:02 variant:02 define:02 On Fri, Feb 08, 2008 at 07:07:58PM +0000, Jon Harrop wrote: > On Friday 08 February 2008 09:53:33 Vincent Hanquez wrote: > > so what's the point in using polymorphics variant then ? > > Brevity: > > | Xml.Error.Succeed x -> f x > | Xml.Error.Failure y -> g y > > vs: > > | `Succeed x -> f x > | `Failure y -> g y > > The alternative is to open the namespace that contains the ordinary variant, > which pollutes your namespace will all of its identifiers. And, I value code readibility more than brevity. in the former case, i know instantly that what i'm comparing is an Xml error; the later case, all i know is we compare that either something fail or succeed. Your option is fine on 100-lines software. it isn't on >= 10K lines software. If the brevity is the only "goodness" of using polymorphics variant, that's particularly ill-advised. Brevity doesn't apply to symbols btw. If it would, you'll name all your variables "a" "b" "c" "d" "e" ... not with useful names. (programming in fortran is over at least in CS) > As Jacques said, polymorphic variants don't define anything, i.e. don't bind > identifiers to type constructors. So they can't pollute anything. The "flat > namespace" you refer to doesn't exist. It defines a "type annotation" that is shared across all your files in one project. this type annotation is in its own flat namespace, i.e. using "`x" in file a.ml is the same as using "`x" in file b.ml (providing you use the same type with `x obviously) > This is the same as strings. You would not discourage the use of "foo" in > programs because it "pollutes the flat namespace of strings" for the same > reason. except you don't do type checking with strings. -- Vincent Hanquez