From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA05117; Thu, 3 Apr 2003 16:50:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 QAA05288 for ; Thu, 3 Apr 2003 16:50:56 +0200 (MET DST) Received: from host07.ipowerweb.com (host07.ipowerweb.com [12.129.206.107]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h33Eot502615 for ; Thu, 3 Apr 2003 16:50:55 +0200 (MET DST) Received: from bikini.inria.fr ([128.93.1.43] helo=rouaix.org) by host07.ipowerweb.com with asmtp (Exim 3.36 #1) id 19163G-0006oN-00 for caml-list@inria.fr; Thu, 03 Apr 2003 06:50:50 -0800 Date: Thu, 3 Apr 2003 16:50:44 +0200 Mime-Version: 1.0 (Apple Message framework v551) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: [Caml-list] mystified by typing of optional arguments From: Francois Rouaix To: caml-list@inria.fr Content-Transfer-Encoding: 7bit Message-Id: X-Mailer: Apple Mail (2.551) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host07.ipowerweb.com X-AntiAbuse: Original Domain - inria.fr X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [0 0] X-AntiAbuse: Sender Address Domain - rouaix.org X-Spam: no; 0.00; typable:01 reproducing:01 checking:01 match:02 typing:03 behavior:03 arguments:03 let:04 meant:05 type:07 function:09 opt:09 --f:13 code:15 but:16 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi all, The following example mystifies me let f ?opt x = match opt with | None -> x | Some dx -> x + dx let g x = x + 1 let h1 = function | 0 -> [g] | _ -> [f; g] let h2 = function | _ -> [f; g] h1 is typable but not h2. Why is that ? --f PS: the example code is not meant to be useful in any way other than reproducing the behavior of type checking. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners