From: Markus Mottl <markus@mail4.ai.univie.ac.at>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: [Caml-list] Why can't I use constructors as functions?
Date: Fri, 3 Aug 2001 12:00:17 +0200 [thread overview]
Message-ID: <20010803120017.A31361@kastanie.ai.univie.ac.at> (raw)
In-Reply-To: <20010803101651.C29703@pauillac.inria.fr>; from Xavier.Leroy@inria.fr on Fri, Aug 03, 2001 at 10:16:51 +0200
On Fri, 03 Aug 2001, Xavier Leroy wrote:
> - Constructors in Caml Light and OCaml really have an arity, e.g.
> C of int * int is really a constructor with two integer arguments,
> not a constructor taking one argument that is a pair. Hence, there
> would be two ways to map the constructor C to a function:
> fun (x,y) -> C(x,y)
> or
> fun x y -> C(x,y)
Why? To me only the latter seems to be consistent with the
constructor. I'd expect the first form in the case of "C of (int * int)",
which is indeed represented differently to "C of int * int".
Actually, this proves that we already have ambiguity, e.g.:
C (1, 2)
How does the definition of this variant look like?
C of int * int
or
C of (int * int)
?
Nobody can tell...
Therefore, I'd rather propose that it be required to write:
C 1 2
if the definition is "C of int * int". I know, this would break a lot
(maybe almost all) code, but could be automatically transformed if
required. Maybe the choice of the type constructor for pairs "*" wasn't
so good: people really confuse this with tuples. Another symbol would
seem more approriate ("&", "^", ...?).
The language would seem much more regular to me if functions and
constructors were treated in a similar way. Would this be too big a
change to the core language?
Regards,
Markus Mottl
--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-08-03 10:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-30 18:51 Krishnaswami, Neel
2001-08-03 8:16 ` Xavier Leroy
2001-08-03 9:19 ` Andreas Rossberg
2001-08-03 10:00 ` Markus Mottl [this message]
[not found] ` <9kffrd$72l$1@qrnik.zagroda>
2001-08-05 12:57 ` Marcin 'Qrczak' Kowalczyk
[not found] <200108031627.JAA19052@dhpc0010.pdx.intel.com>
2001-08-06 8:14 ` Xavier Leroy
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=20010803120017.A31361@kastanie.ai.univie.ac.at \
--to=markus@mail4.ai.univie.ac.at \
--cc=Xavier.Leroy@inria.fr \
--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