From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: caml-list@inria.fr (OCAML)
Subject: Initializing default arguments
Date: Thu, 13 Jan 2000 16:05:27 +0100 (MET) [thread overview]
Message-ID: <200001131505.QAA12513@miss.wu-wien.ac.at> (raw)
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
next reply other threads:[~2000-01-13 16:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-13 15:05 Markus Mottl [this message]
2000-01-14 3:00 ` Jacques Garrigue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200001131505.QAA12513@miss.wu-wien.ac.at \
--to=mottl@miss.wu-wien.ac.at \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox