caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] How to use ocaml.warning
@ 2019-07-26  2:14 Ian Zimmerman
  2019-07-26  4:37 ` Nicolás Ojeda Bär
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Zimmerman @ 2019-07-26  2:14 UTC (permalink / raw)
  To: Caml Mailinglist

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-26 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-26  2:14 [Caml-list] How to use ocaml.warning Ian Zimmerman
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

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).