caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
To: "Mr. Herr" <misterherr@freenet.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Syntax for several matches, each with a "when" clause, but only one result
Date: Mon, 23 May 2016 17:35:26 +0200	[thread overview]
Message-ID: <20160523153526.GC2339@delli7.univ-savoie.fr> (raw)
In-Reply-To: <573EE587.1070504@freenet.de>

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]


Hello,

personnaly, I am not happy with the semantics of when guarded clause (and If I remember well
already mentionned it on the list):

match (1,2) with
  (x,y) | (y,x) when y <= x -> (x,y)
| _ -> assert false

will raise an assert false ... while being quite elegant ...

I think "when" should be distributive on "or pattern", which would imply that "when" should be allowed deep in patterns.

It certainly makes pattern compilation harder, but it should not really change the completeness of pattern analysis
because guarded clause are more or less ignored ?

Cheers,
Christoĥe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

      reply	other threads:[~2016-05-23 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20  7:57 Soegtrop, Michael
2016-05-20  8:37 ` Mr. Herr
2016-05-20 10:04   ` Soegtrop, Michael
2016-05-20 10:23     ` Mr. Herr
2016-05-23 15:35       ` Christophe Raffalli [this message]

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=20160523153526.GC2339@delli7.univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.fr \
    --cc=caml-list@inria.fr \
    --cc=misterherr@freenet.de \
    /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).