caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: [Caml-list] Warning 28.
Date: Wed, 5 Jun 2013 08:54:48 +0200	[thread overview]
Message-ID: <CA+yPOVjWSkA=p4F6_33WVivS6f-UDoDxXhq6uP+xNv8i+zHSfw@mail.gmail.com> (raw)
In-Reply-To: <87sj0xqgb8.fsf@golf.niidar.ru>

Hello Ivan,

2013/6/5 Ivan Gotovchits <ivg@ieee.org>:
>     | Ref n -> ...
>     ...
>
> where Ref is:
>
> type t =
>   ...
>   | Ref of int
>
> Compiler issues me a warning:
>
> «Warning 28: wildcard pattern given as argument to a constant constructor»
>
> Sorry, but if I understand this wording correctly, then I do not see
> anything criminal in issuing a wildcard pattern to a constant
> constructor. What is wrong?

OCaml is not complaining about your Ref constructor, but another one
that does not have any argument, but is nevertheless given a wildcard
pattern in the matching, as e.g. None in
the following code:

# let f default = function
  | Some n -> n
  | None _ -> default;;
Warning 28: wildcard pattern given as argument to a constant constructor

The 'None _'  is suspicious at best. Tolerating such kind of pattern
reportedly eases generation of OCaml code, and that's why it is a
warning and not a plain error.

Best regards,
--
E tutto per oggi, a la prossima volta
Virgile

  reply	other threads:[~2013-06-05  6:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05  5:26 Ivan Gotovchits
2013-06-05  6:54 ` Virgile Prevosto [this message]
2013-06-05  7:04   ` Ivan Gotovchits
2013-06-05  7:22     ` Alain Frisch

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='CA+yPOVjWSkA=p4F6_33WVivS6f-UDoDxXhq6uP+xNv8i+zHSfw@mail.gmail.com' \
    --to=virgile.prevosto@m4x.org \
    --cc=caml-list@inria.fr \
    /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).