From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA09837 for caml-redistribution; Thu, 13 Jan 2000 17:35:13 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA02888 for ; Thu, 13 Jan 2000 16:05:44 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id QAA09105 for ; Thu, 13 Jan 2000 16:05:41 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id QAA12513 for caml-list@inria.fr; Thu, 13 Jan 2000 16:05:28 +0100 (MET) From: Markus Mottl Message-Id: <200001131505.QAA12513@miss.wu-wien.ac.at> Subject: Initializing default arguments To: caml-list@inria.fr (OCAML) Date: Thu, 13 Jan 2000 16:05:27 +0100 (MET) X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis Hello, I just wondered about ways to get rid of definitions like let rec foo_aux init = ... let foo = foo_aux [] using labels and default arguments. There I found a problem with functions like: let rec tautology ?(:vs = variables t) t = ... It is not possible to reference arguments (here: 't') from default arguments if they appear later in the function definition. It is clear that this would be problematic if the other argument also had a default value and if it referenced the first value again (recursion). However, I believe it should be always ok to use non-default arguments regardless of order, because they are always already initialized. The following does not work as intended let rec tautology t ?(:vs = variables t) = ... because I would have to place further arguments after it so that the default argument can be erased (e.g. by adding '()'). Although the latter requirement is not really painful it is at least not as convenient as it could be. Is it possible to remove this restriction or are there further problems I did not foresee? Best regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl