caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ian Zimmerman <itz@very.loosely.org>
To: Caml Mailinglist <caml-list@inria.fr>
Subject: [Caml-list] How to use ocaml.warning
Date: Thu, 25 Jul 2019 19:14:01 -0700	[thread overview]
Message-ID: <20190726021401.6u7mtlfy4exc756q@matica.foolinux.mooo.com> (raw)

Hello, I wonder how to use the ocaml.warning attribute described here:

https://caml.inria.fr/pub/docs/manual-ocaml-4.08/manual035.html#sec265

To describe my situation, I had a list l of int pairs which I could prove
non-empty and I wanted to extract the first two ints.  I wrote

  let (i, j) :: rest = l in ...

and of course I got warning 8.  So I got interested in ways to suppress
the warning, and I read about the attributes which are new to me and
made me curious :P  I tried to insert

  [@ocaml.warning "-8"]

at many points in the code -- before the "let", before and after the
equal sign, and before "in" -- but none of these ways got rid of the
warning.  I gave up and used List.hd.  But I am still curious about the
intended or correct usage of the attribute feature.

Thanks.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.

             reply	other threads:[~2019-07-26  2:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  2:14 Ian Zimmerman [this message]
2019-07-26  4:37 ` Nicolás Ojeda Bär
2019-07-26 15:52   ` Ian Zimmerman
2019-07-26 15:55     ` Nicolás Ojeda Bär

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=20190726021401.6u7mtlfy4exc756q@matica.foolinux.mooo.com \
    --to=itz@very.loosely.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).