caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: Jacques-Henri Jourdan <jacques-henri.jourdan@normalesup.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml 4.03 and warning 52 : argument of this constructor should not be matched against a constant pattern
Date: Thu, 28 Apr 2016 09:25:58 +0200	[thread overview]
Message-ID: <20160428072558.GA10554@frosties> (raw)
In-Reply-To: <57208EA3.6030801@normalesup.org>

On Wed, Apr 27, 2016 at 12:04:19PM +0200, Jacques-Henri Jourdan wrote:
> I think it has been introduced in 4.02.
> 
> On 04/27/2016 12:00 PM, Daniel Bünzli wrote:
> > Le mercredi, 27 avril 2016 à 11:43, Jacques-Henri Jourdan a écrit :
> >> Or, with the new pattern matching with exception syntax :
> >>  
> >> match List.hd lst with
> >> | exception Failure _ -> Printf.printf "empty list\n"
> >> | hd -> ...
> > When was that introduced again ? I'm now starting to move to 4.01 language-wise.  
> >
> > Daniel

That's rarther stupid in this case. Why create and catch an exception
when you can just match the list directly?

    match lst with
    | [] -> Printf.printf "empty list\n"
    | hd::_ -> ...

MfG
	Goswin

  reply	other threads:[~2016-04-28  7:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27  9:22 William
2016-04-27  9:28 ` David Allsopp
2016-04-27  9:36 ` Daniel Bünzli
2016-04-27  9:43   ` Jacques-Henri Jourdan
2016-04-27  9:51     ` Roberto Di Cosmo
2016-04-27 10:00     ` Daniel Bünzli
2016-04-27 10:04       ` Jacques-Henri Jourdan
2016-04-28  7:25         ` Goswin von Brederlow [this message]
2016-04-27 11:01 ` Gabriel Scherer
2016-04-27 17:17   ` Adrien Nader
2016-04-27 18:20     ` Gabriel Scherer

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=20160428072558.GA10554@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    --cc=jacques-henri.jourdan@normalesup.org \
    /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).