From: Fergus Henderson <fjh@cs.mu.OZ.AU>
To: Xavier Leroy <xavier.leroy@inria.fr>
Cc: Pixel <pixel@mandrakesoft.com>, caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] raise extra arg ignored
Date: Tue, 27 Nov 2001 02:12:39 +1100 [thread overview]
Message-ID: <20011127021238.B10358@earth.cs.mu.oz.au> (raw)
In-Reply-To: <20011029112632.A22962@pauillac.inria.fr>
On 29-Oct-2001, Xavier Leroy <xavier.leroy@inria.fr> wrote:
> > failwith "foo" "bar"
> > failwith "foo"
> >
> > are equivalent.
> >
> > exception Foo;;
> > raise Foo 1
> > raise Foo
> >
> > same for this.
>
> Yes. For additional fun, you could do
> print_string (raise Foo);;
> print_int (raise Foo);;
> raise Foo + 2;;
>
> Notice that this also works for certain non-terminating functions:
[...]
> > I understand why it typechecks, but couldn't there be a special
> > check for this since it can't be useful (or can it??)
>
> Possibly, but that would not be easy to do: we'd have to wait until
> type inference for the phrase is completed, remember the principal
> types inferred for each sub-expression, and apply ad-hoc checks such as
> "warn if an expression of principal type 'a ('a being generalizable in
> the context) is applied as if it were a function". This really
> doesn't fit well in the current OCaml type inference technology.
How about ignoring the types, and instead issuing a warning whenever
any expression which always raises an exception is used as a function
argument, or as the function term in a function application?
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
prev parent reply other threads:[~2001-11-26 15:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-27 19:51 Pixel
2001-10-27 20:30 ` Daniel de Rauglaudre
2001-10-27 23:44 ` Pixel
2001-10-28 19:47 ` Nicolas George
2001-10-29 10:26 ` Xavier Leroy
2001-10-30 21:29 ` Pierre Weis
2001-10-30 22:17 ` Dave Mason
2001-10-31 17:57 ` Daniel de Rauglaudre
2001-10-31 19:09 ` Remi VANICAT
2001-11-01 10:01 ` Daniel de Rauglaudre
2001-11-26 15:12 ` Fergus Henderson [this message]
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=20011127021238.B10358@earth.cs.mu.oz.au \
--to=fjh@cs.mu.oz.au \
--cc=caml-list@pauillac.inria.fr \
--cc=pixel@mandrakesoft.com \
--cc=xavier.leroy@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