From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 64E9FBC2F for ; Tue, 30 Nov 2004 15:05:18 +0100 (CET) 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 iAUE5IM7020986 for ; Tue, 30 Nov 2004 15:05:18 +0100 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 PAA08050 for ; Tue, 30 Nov 2004 15:05:17 +0100 (MET) Received: from yquem.inria.fr (yquem.inria.fr [128.93.8.37]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iAUE5HHk020981; Tue, 30 Nov 2004 15:05:17 +0100 Received: by yquem.inria.fr (Postfix, from userid 18041) id 5D2DEBC2F; Tue, 30 Nov 2004 15:05:17 +0100 (CET) Date: Tue, 30 Nov 2004 15:05:17 +0100 To: Christophe Raffalli Cc: caml-list@inria.fr Subject: Re: [Caml-list] partial match in let Message-ID: <20041130140517.GB28683@yquem.inria.fr> References: <41AB5819.2020206@univ-savoie.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41AB5819.2020206@univ-savoie.fr> User-Agent: Mutt/1.3.28i From: luc.maranget@inria.fr (Luc Maranget) X-Miltered: at concorde with ID 41AC7E1E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41AC7E1D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 luc:01 maranget:01 luc:01 maranget:01 foo:01 foo:01 usefull:01 christophe:01 raffalli:01 argued:01 'let:01 cheers:01 pat:01 assert:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: > > Wish: I had like a way to avoid the partial match warning in code like > > let [x;y] = f (x) in foo > > Because if foo is long writing > > match f(x) with [x;y] -> foo | _ -> assert false > > is really ennoying, especially if you have a long sequence of let. > > I find usefull the partial match warning for match and function but not > for let (if you write a let, I think you are aware that your matching > will be partial for any data type with more than one constructor, you do > not need a warning) > > -- > Christophe Raffalli I think the warning clearly is useful even in this situation of a pattern in let. In fact it can even be argued that 'let pat = exp in exp' should be legal only when 'pat' provable cannot fail. And the is camlp4 'revised syntax' approach, as far as I remember. I also remark that your sentence 'I think you are aware that your matching will be partial for any data type with more than one constructor, you do not need a warning' Does not apply to novices or in case of type alteration. Besides a simple solution using a function has been given. Cheers, -- Luc Maranget