caml-list - the Caml user's mailing list
 help / Atom feed
From: "Soegtrop, Michael" <michael.soegtrop@intel.com>
To: Norman Hardy <norm@cap-lore.com>, Florian Weimer <fw@deneb.enyo.de>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: RE: [Caml-list] Newbie comment on constructor syntax
Date: Mon, 9 Nov 2015 08:09:30 +0000
Message-ID: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E747@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <BAA48D58-10C7-4ADF-A415-2B850A06F973@cap-lore.com>

Dear Florian, Norman, 

> > Curiously, the argument is not really a tuple.  This does not work:
> >
> > type x = X of int * int
> > let c = (1, 2) in X c
> 
> However the following works:
> # type x  = X of (int * int);;
> type x = X of (int * int)
> # let c = (1, 2) in X c;;
> - : x = X (1, 2)

Exactly this is what is quite confusing (for the beginner): constructors are a rather odd mix of multiple arguments and tuples. The notation looks like tuples, both in definition and use, but it isn't. And it is not a multiple argument function either, since currying doesn't work. That adding parenthesis makes it a real tuple doesn't make it better, since at some other places a*b and (a*b) are the same.

To me this is quite a scar in the beauty of the language - the kind of thing you can't avoid to look at, if you know what I mean. Of cause it is not really an issue. It is just way disappointing for new users to find this kind of imperfection and it gives a little dent in the enthusiasm. But just a little one ;-)

Best regards,

Michael

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  parent reply index

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06  9:33 Soegtrop, Michael
2015-11-06 10:04 ` Nicolas Ojeda Bar
2015-11-06 10:31 ` Francois Berenger
2015-11-06 12:20   ` Soegtrop, Michael
2015-11-06 12:34     ` Gabriel Scherer
2015-11-06 13:09       ` Soegtrop, Michael
2015-11-06 14:10         ` Ashish Agarwal
2015-11-06 15:19           ` Soegtrop, Michael
2015-11-06 15:22             ` Ashish Agarwal
2015-11-21 17:24       ` [Caml-list] Notation for currying Hendrik Boom
2015-11-21 17:42         ` Gabriel Scherer
2015-11-21 18:06         ` David Rajchenbach-Teller
2015-11-21 18:56           ` Gabriel Scherer
2015-11-06 12:29 ` [Caml-list] Newbie comment on constructor syntax Jonas Jensen
2015-11-06 12:46   ` Soegtrop, Michael
2015-11-06 12:55     ` Gabriel Scherer
2015-11-08 21:17 ` Florian Weimer
2015-11-08 22:51   ` Norman Hardy
2015-11-09  6:27     ` Florian Weimer
2015-11-09 13:27       ` Stefan Monnier
2015-11-09  8:10     ` Soegtrop, Michael [this message]
2015-11-09 10:00       ` Hendrik Boom
2015-11-09 10:17       ` Alain Frisch
2015-11-09 10:35         ` Andreas Rossberg
2015-11-09 12:28           ` Alain Frisch
2015-11-09 17:33           ` Alain Frisch
2015-11-09 18:09             ` Gabriel Scherer
2015-11-09 18:16               ` Andreas Rossberg
2015-11-09 21:12                 ` Gabriel Scherer
2015-11-09 22:06                   ` Alain Frisch
2015-11-09 22:27                   ` Andreas Rossberg
2015-11-09 22:57                     ` Jeremy Yallop
2015-11-10  0:11                   ` Hendrik Boom
2015-11-10  8:27                   ` Soegtrop, Michael
2015-11-10 10:26                     ` Romain Bardou
2015-11-10 10:44                       ` Alain Frisch
2015-11-10 10:55                         ` Romain Bardou
2015-11-10 13:17                           ` Alain Frisch
2015-11-10 13:41                             ` Romain Bardou
2015-11-10 14:01                               ` Alain Frisch
2015-11-13 15:36                           ` Romain Bardou
2015-11-10 11:17                         ` Soegtrop, Michael
2015-11-10 14:11                     ` Hendrik Boom
2015-11-10 14:40                       ` immanuel litzroth
2015-11-10 15:30                       ` Soegtrop, Michael
2015-11-10 17:28                         ` Gerd Stolpmann
2015-11-09 20:32               ` Alain Frisch

Reply instructions:

You may reply publically 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=0F7D3B1B3C4B894D824F5B822E3E5A172CE3E747@IRSMSX102.ger.corp.intel.com \
    --to=michael.soegtrop@intel.com \
    --cc=caml-list@inria.fr \
    --cc=fw@deneb.enyo.de \
    --cc=norm@cap-lore.com \
    /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

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox