caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: rossberg@ps.uni-sb.de
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Unsoundness is essential
Date: Fri, 05 Oct 2007 08:23:37 +1000	[thread overview]
Message-ID: <1191536617.7771.18.camel@rosella.wigram> (raw)
In-Reply-To: <60599.84.159.34.129.1191532048.squirrel@www.ps.uni-sb.de>

On Thu, 2007-10-04 at 23:07 +0200, rossberg@ps.uni-sb.de wrote:
> skaller wrote:
> >
> >> Exceptions are /trapped/ errors.
> >
> > I chose not to accept that definition. I use instead
> > "trapped at compile time", meaning "in advance of running
> > the program".
> 
> As a definition for what?

What trapped means.

> > Otherwise you could say dynamically typed languages were
> > strongly typed and sound.
> 
> In fact, technically, they are. People have used the term "unityped" for it.

That isn't what I meant at all. Python is statically unityped, but
dynamically it has integers, reals, strings, etc. Type errors
in Python are not 'trapped' .. they're impossible.

> > C/C++ does this right: if a program is 'ill-formed' then
> > a diagnostic must be issued. Throwing an exception silently
> > is NOT allowed. [C/C++ doesn't mandate diagnostics always because
> > some are too hard to detect]
> 
> This paragraph sounds like a contradiction in itself.

Yes, but it isn't. If the specification was to throw
a catchable exception, then that would be a requirement
on implementation which would permit programmers to divide
by zero deliberately. In that case, a divide by zero error
is impossible to detect because it can't be distinguished
from the legitimate division by zero for the purpose
of raising an exception.

> More importantly, an OCaml program performing div 0 isn't "ill-formed", it
> has a perfectly well-defined, safe semantics (in precisely the same way as
> adding a string in Python). See the library docs.

I didn't claim otherwise: I claim it is a very bad idea
to permit a program to do obvious bullshit like divide by zero
(for integers I mean).

Note I'm NOT saying Ocaml *implementation* shouldn't raise an exception,
just that the language specification should not require it do so.
The difference is in one case the operation is semantically well defined
and thus definitely not detectable as an error, whereas in the other
it is not defined, and so is unequivocably an error.

Oh well this was fun but I'm off interstate without a computer for
a week.. hope my Airbus doesn't divide any empty lists by zero ..

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2007-10-04 22:23 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03  8:35 Locally-polymorphic exceptions [was: folding over a file] oleg
2007-10-03 11:27 ` kirillkh
2007-10-03 11:48   ` [Caml-list] " Daniel de Rauglaudre
2007-10-03 12:19     ` kirillkh
2007-10-03 12:32       ` Daniel de Rauglaudre
2007-10-03 14:34         ` kirillkh
2007-10-03 20:39   ` Christophe Raffalli
2007-10-03 22:50     ` Unsoundness is essential skaller
2007-10-03 23:13       ` [Caml-list] " Jacques Carette
2007-10-04  1:24         ` skaller
2007-10-04 11:26           ` David Allsopp
2007-10-04 12:45             ` Vincent Hanquez
2007-10-04 15:07               ` skaller
2007-10-03 23:13       ` Vincent Aravantinos
2007-10-04  1:49         ` skaller
2007-10-03 23:28       ` Joshua D. Guttman
2007-10-04  1:52         ` skaller
2007-10-04  2:35           ` Brian Hurt
2007-10-04  7:46           ` Christophe Raffalli
2007-10-04  8:56             ` Arnaud Spiwack
2007-10-04 14:49               ` skaller
2007-10-04 15:00                 ` Harrison, John R
2007-10-04 15:29                 ` Andrej Bauer
2007-10-04 16:25                   ` skaller
2007-10-04 18:17                     ` Arnaud Spiwack
2007-10-04 20:54                       ` skaller
2007-10-04 22:24                         ` Arnaud Spiwack
2007-10-04 16:37                   ` skaller
2007-10-04 18:59                     ` Christophe Raffalli
2007-10-04 15:04               ` Andrej Bauer
2007-10-04 15:57                 ` Christophe Raffalli
2007-10-04 16:03                 ` skaller
2007-10-04 20:02                   ` Ken Rose
2007-10-04 21:00                     ` skaller
2007-10-04 15:31       ` Lukasz Stafiniak
2007-10-04 17:56       ` rossberg
2007-10-04 19:56         ` skaller
2007-10-04 21:07           ` rossberg
2007-10-04 22:23             ` skaller [this message]
2007-10-05  2:48               ` Bárður Árantsson
2007-10-04  2:16   ` Locally-polymorphic exceptions [was: folding over a file] 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=1191536617.7771.18.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=rossberg@ps.uni-sb.de \
    /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).