caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: luc.maranget@inria.fr (Luc Maranget)
To: Michael Vanier <mvanier@cs.caltech.edu>
Cc: Adam Granicz <granicz.adam@vnet.hu>,
	"caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] syntax question
Date: Fri, 30 May 2008 09:06:24 +0200	[thread overview]
Message-ID: <20080530070624.GC22257@yquem.inria.fr> (raw)
In-Reply-To: <483F54A5.4020808@cs.caltech.edu>

> Adam,
> 
> I realize that this is how it works, but I don't understand why it should 
> work this way. AFAIK elsewhere in ocaml "int * int" always refers to a 
> tuple.  Similarly, if testme's Foo really took two int arguments I would 
> expect to be able to create Foos as "Foo 1 2" instead of "Foo (1, 2)" which 

You understanding of constructors is correct : they take n arguments.
Yes, the concrete syntax does not properly reflect the underlying
semantics, with its fake tuple.

Why is this so ? Why ask ? 

In case you are just curious, it can probably be tracked back to the
original Caml where constructors took 0 or 1 arguments, and where
tuples were primitive.

Now, this is so for historical reasons and we live with it.

Alternatives can be considered, best of which probably is the
curried notation. But it is much too late to change that
(but as pointed by others, there is an alternative, "revised", syntax).



> 
> Mike
> 

--Luc


  parent reply	other threads:[~2008-05-30  7:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29 22:23 Michael Vanier
2008-05-30  0:32 ` [Caml-list] " Adam Granicz
2008-05-30  1:13   ` Michael Vanier
2008-05-30  1:48     ` Adam Granicz
2008-05-30  1:54     ` Gordon Henriksen
2008-05-30  7:03     ` Christophe TROESTLER
2008-05-30  7:06     ` Luc Maranget [this message]
2008-05-30 12:17     ` Damien Doligez

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=20080530070624.GC22257@yquem.inria.fr \
    --to=luc.maranget@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=granicz.adam@vnet.hu \
    --cc=mvanier@cs.caltech.edu \
    /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;
as well as URLs for NNTP newsgroup(s).