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.6 required=5.0 tests=AWL,WEIRD_QUOTING autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 94532BC6C for ; Tue, 5 Feb 2008 12:06:50 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAEbRp0fAXQInh2dsb2JhbACQKwEBAQgKKZwe X-IronPort-AV: E=Sophos;i="4.25,307,1199660400"; d="scan'208";a="8769611" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Feb 2008 12:06:49 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m15B6gXn030188 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 5 Feb 2008 12:06:49 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAF7Sp0fUVZgL/2dsb2JhbACtCA X-IronPort-AV: E=Sophos;i="4.25,307,1199660400"; d="scan'208";a="22208456" Received: from hades.snarc.org ([212.85.152.11]) by mail4-smtp-sop.national.inria.fr with ESMTP; 05 Feb 2008 12:06:43 +0100 Received: by hades.snarc.org (Postfix, from userid 1000) id D673F1B482; Tue, 5 Feb 2008 12:06:41 +0100 (CET) Date: Tue, 5 Feb 2008 12:06:41 +0100 To: =?iso-8859-1?Q?B=FCnzli?= Daniel Cc: caml-list List Subject: Re: [Caml-list] [OSR] Exceptionless error management Message-ID: <20080205110641.GA4712@snarc.org> References: <1202205644.6226.5.camel@Blefuscu> <20080205101221.GA3922@snarc.org> <9A13D5E1-E455-4019-B0BA-D8D7DD4CE49E@erratique.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9A13D5E1-E455-4019-B0BA-D8D7DD4CE49E@erratique.ch> 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-Miltered: at concorde with ID 47A84342.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0100,:01 bunzli:01 monadic:01 haskell's:01 variants:01 variants:01 ocaml:01 val:01 pervasives:01 patching:01 ocaml:01 stdlib:01 compiler:01 stdlib:01 hashtbl:01 On Tue, Feb 05, 2008 at 11:26:00AM +0100, Bünzli Daniel wrote: >> I can see lots of people are concerned by using polymorphic variant (and >> I certainly agree with those), and people asking for a monadic approch >> (haskell's either like). > > Still I think this is a little bit sad. Using polymorphic variants isn't > that bad at all as long as we just use the following _closed_ type [ `Value > of ... | `Error of ... ]. imho, polymorphic variants ""weaken"" the type system and are a royal PITA when something is wrong in the code and you need to find it. for example something plain _stupid_ as: returning or matching `VAlue instead of `Value since it will be created "dynamicly" (you don't need to define it), ocaml will be perfectly happy to return/match it, but you'll have a "weird" error somewhere else: # let f x : [`Error | `Value of int ] = if x <= 0 then `Error else `Value x;; val f : int -> [ `Error | `Value of int ] = # let g y = match f y with `Error -> "error" | `VAlue x -> "value" This pattern matches values of type [< `Error ] but is here used to match values of type [ `Error | `Value of int ] The first variant type does not allow tag(s) `Value with normal variant i'll have a nice error: Unbound constructor VAlue And that's just one thing on the list of 'against' polymorphic variants; i'm sure people have their own set of bad experiences with polymorphic variants. > This would allow us to move forward despite that > fact that Pervasives is frozen (and no I'm not interested in forking it). This is not "forking", for me that's patching. We _can_ provide the same interface+improvements (no breaking of previous programs) easily _without_ forking with minimal intrusion as a patchqueue on top of ocaml stdlib. the compiler might be forbidden fruit (license, INRIA expertise, etc) and that's probably a bad idea to fork it anyway, but stdlib should be where we could add major improvement to the language (a rich and nice stdlib just like all other languages). Also a proposal that define exceptionless without having the core library like Hashtbl, Map, Set, List, conforms to this "standard" is just bound to failure. Either they are modified (bad idea for compability), Copied+forked into another module (nobody going to use it + you're forking some of the stdlib) or the proposal is moot. > Sure we can have monadic stuff, new types, new infrastructure etc. but I > try to design solely within the constraint of the ocaml system as it stands > because I know that's something has been there for more than 10 years and > continues to be maintained. > Polymorphic variants have the advantage to > allow us to standardize across modules without needing changes to the ocaml > system. they might be standard in ocaml (as in available through the compiler), but not much library use them. people should have that in mind when trying to propose them as an OSR; lots of people are not confortable with them imo. -- Vincent Hanquez