From: "Frédéric van der Plancke" <fvdp@decis.be>
To: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Warning wished
Date: Wed, 28 Jan 2009 19:29:44 +0100 [thread overview]
Message-ID: <4980A418.3040003@decis.be> (raw)
In-Reply-To: <49806F33.7090205@tepkom.ru>
Dmitri Boulytchev wrote:
>
>> Applying g to 1 you will definitely have f x of type int and you have to
>> take care of the returned integer. Unfortunatly caml emits no warning in
>> this case (even if I understand why) :(.
>>
> Sure :) But as far as I understand this warning means "this
> non-unit value will definitely be omitted, and this
> can be possibly wrong". Under this interpretation the compiler has to
> ensure undoubtedly that the value is
> always non-unit.
> BTW you may (temporarily) change your code into something like
>
> let f x = [x]
>
> of even into
>
> let f x = object method get = x end
>
> and find all the suspicious places :)
>
> Best regards,
> Dmitri.
There's the question of what the compiler _does_, what the compiler
_could_ do and what the compiler _should_ do.
I don't think "this 'a could be unit" is a good reason for skipping the
warning. On the contrary, "this 'a will probably sometimes be a real
value" seems a sufficient reason to add a warning. If needed, the
programmer can easily suppress the warning by adding "ignore" or adding
a ": unit" type constraint (whichever applies).
(Remains to see whether adding the warning to OCaml is worth the manwork.)
Frédéric
next prev parent reply other threads:[~2009-01-28 18:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 13:53 Julien SIGNOLES
2009-01-28 14:07 ` Re : [Caml-list] " Matthieu Wipliez
2009-01-28 14:24 ` Julien SIGNOLES
2009-01-28 20:56 ` Nicolas Pouillard
2009-01-28 14:10 ` Dmitri Boulytchev
2009-01-28 14:28 ` Julien SIGNOLES
2009-01-28 14:44 ` Dmitri Boulytchev
2009-01-28 18:29 ` Frédéric van der Plancke [this message]
2009-01-28 19:08 ` Dmitri Boulytchev
2009-01-28 16:55 ` Martin Jambon
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=4980A418.3040003@decis.be \
--to=fvdp@decis.be \
--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