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 EAA08853; Wed, 4 Jun 2003 04:58:36 +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 EAA08297 for ; Wed, 4 Jun 2003 04:58:35 +0200 (MET DST) Received: from relay.pair.com (relay.pair.com [209.68.1.20]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id h542wYH21033 for ; Wed, 4 Jun 2003 04:58:34 +0200 (MET DST) Received: (qmail 83274 invoked from network); 4 Jun 2003 02:58:33 -0000 Received: from arda.pair.com (HELO checkerdell.d6.com) (209.68.1.133) by relay.pair.com with SMTP; 4 Jun 2003 02:58:33 -0000 X-pair-Authenticated: 209.68.1.133 Message-Id: <4.3.2.7.2.20030603195340.032a40e0@localhost> X-Sender: checker@localhost X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Tue, 03 Jun 2003 19:58:19 -0700 To: caml-list@inria.fr From: Chris Hecker Subject: [Caml-list] optional arguments and unification Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Spam: no; 0.00; hecker:01 checker:01 unification:01 unspecified:01 unsound:01 compiler:01 chris:01 int:01 arguments:03 types:03 let:04 ugly:05 type:07 i'm:07 opt:09 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'm not sure I'm using the term "unification" properly, but here's the situation: let f ?opt x = x + 1 let g x = x + 1 let h = if true then f else g This expression has type int -> int but is here used with type ?opt:'a -> int -> int So you have to do this: let h = if true then f ?opt:None else g Which is kinda ugly and goes against the "spirit" of optional arguments, I think. Would it be possible to have a rule that says "if two types need to be unified and the only thing standing in the way are unspecified optional arguments then the compiler will default them automatically"? Or does that lead to something unsound? Chris ------------------- 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