From: Richard Jones <rich@annexia.org>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Constructors are not functions
Date: Tue, 6 Oct 2009 14:38:58 +0100 [thread overview]
Message-ID: <20091006133858.GA13733@annexia.org> (raw)
In-Reply-To: <200910061338.20954.jon@ffconsultancy.com>
On Tue, Oct 06, 2009 at 01:38:20PM +0100, Jon Harrop wrote:
> On Tuesday 06 October 2009 13:19:58 Philippe Wang wrote:
> > Hello,
> >
> > I don't know the actual reason, but I guess it's simply a choice of
> > semantics.
> >
> > It woud be weird to be able to deconstruct (Bar 42) while not be able
> > to deconstruct (Bar) as it's not constructed.
> > I mean we can write (match x with Bar y -> y).
> > If partial construction were accepted we may like to write
> > (match x with Bar -> x) but we couldn't because Bar is like a function
> > then.
> >
> > With type t = A | B of int
> > what would be the error warning for
> > (match x with A -> 42 | B -> 43) ?
> >
> > Well, then I guess the reason is that it would be complicated to
> > choose some sound enough semantics for partial application of
> > constructors, since the solution of having to write (fun x -> Bar x)
> > is much simpler.
>
> Can you not just say that Bar in an expression is a function (fun x -> Bar x)?
This is what standard ML seems to do.
Rich.
--
Richard Jones
Red Hat
next prev parent reply other threads:[~2009-10-06 13:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-06 12:01 Chantal KELLER
2009-10-06 12:19 ` [Caml-list] " Philippe Wang
2009-10-06 12:38 ` Jon Harrop
2009-10-06 13:38 ` Richard Jones [this message]
2009-10-10 11:49 ` blue storm
2009-10-06 12:45 ` David Allsopp
2009-10-06 12:46 ` David Allsopp
2009-10-06 13:14 ` Jim Farrand
2009-10-06 13:51 ` Michel Mauny
2009-10-06 13:15 ` Jon Harrop
2009-10-06 14:04 ` David Allsopp
2009-10-06 14:51 ` Jon Harrop
2009-10-06 15:24 ` Richard Jones
2009-10-06 16:31 ` Jacques Garrigue
2009-10-08 12:37 ` Goswin von Brederlow
2009-10-09 6:29 ` David Allsopp
2009-10-10 6:16 ` Goswin von Brederlow
2009-10-06 13:18 ` Gerd Stolpmann
2009-10-06 15:50 ` Jérémie Dimino
2009-10-06 21:55 ` blue storm
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=20091006133858.GA13733@annexia.org \
--to=rich@annexia.org \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.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
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