From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml considered dangerous
Date: Mon, 20 Jan 2014 11:07:29 +0100 [thread overview]
Message-ID: <20140120100729.GG26447@frosties> (raw)
In-Reply-To: <52D87CA9.4070500@braud-santoni.eu>
On Fri, Jan 17, 2014 at 01:43:21AM +0100, Nicolas Braud-Santoni wrote:
> Dear Jürgen,
>
> First, for completeness' sake, the correct URL is
> http://www.pfitzenmaier.de/posts/ocaml-considered-dangerous.html
>
> It seems that most of the points in this blog post boil down to your
> confusion regarding the signification of 'a in types.
> Consider the following:
> let x : 'a = 0;;
> val x : int = 0
>
> whereas
> let x: 'a. 'a = 0;;
> Error: This definition has type int which is less general than 'a. 'a
>
> In the first case, 'a is a unification variable, which the compiler may
> unify with int.
> In the second case, we quantify universally over 'a.
>
> As such, I would say that your claims of unsoundness were rather hasty,
> especially given that you follow-up by advertising your services.
> Moreover, as Daniel Bünzli pointed out, problem reports are usually done
> on the bugtracker.
>
> Kind regards,
> Nicolas
It should also be noted that he claims the compiler produces faulty
programms. But all his examples are about the compiler rejecting some
bit of code that he thinks should be accepted.
So his code, which the compiler currently accepts or he couldn't run
it, crashes and he blames the compiler because other code doesn't get
accepted. Does that make any sense?
Seems to me that the crashes are more likely caused by his tinkering
with the compiler trying to get code accepted that the compiler
currently rejects because they are (or could be) unsound. Punhcing
holes in the type system like that obviously can cause crashes as can
use of Obj.magic to work around the type system.
Dear Jürgen,
Your first half seems to be, as mentioned, about misunderstanding the
type system. You might want to read up on universal and existential
types and unification. I also recommend reading up on the value
restriction, which explains why you sometimes loose polymorphism
unless you lift arguments.
As for your "Frightening discoveries" in the second half of your post:
Ocaml inferes types. Some types are infered by how the function is
declared and some types are infered by how the function (or method) is
USED, esspecially within objects. In the full example the use of the
method lets the compiler infere the right type so everything works.
But when you simplify the example to the point where the use case
disapears that is no longer possible and the compiler tells you so.
This can be surprising and anoying at times but that is how it works.
It does not mean the compiler accepted something in the longer example
that was unsound.
MfG
Goswin
next prev parent reply other threads:[~2014-01-20 10:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 23:00 Jürgen Pfitzenmaier
2014-01-16 23:27 ` Milan Stanojević
2014-01-16 23:33 ` Daniel Bünzli
2014-01-17 0:43 ` Nicolas Braud-Santoni
2014-01-20 10:07 ` Goswin von Brederlow [this message]
2014-01-17 2:12 ` Jeff Meister
2014-01-17 2:38 ` Jacques Garrigue
2014-01-17 9:01 ` Gabriel Scherer
2014-01-18 0:39 ` Jon Harrop
2014-01-18 2:22 ` Jeremy Yallop
2014-01-18 7:04 ` Gabriel Scherer
2014-01-18 9:11 ` David Allsopp
2014-01-18 9:28 ` Gabriel Scherer
2014-01-18 9:43 ` David Allsopp
2014-01-18 9:59 ` Gabriel Scherer
2014-01-19 6:09 ` oleg
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=20140120100729.GG26447@frosties \
--to=goswin-v-b@web.de \
--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