caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <weis@pauillac.inria.fr>
To: xavier.leroy@inria.fr (Xavier Leroy)
Cc: pixel@mandrakesoft.com, caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] raise extra arg ignored
Date: Tue, 30 Oct 2001 22:29:03 +0100 (MET)	[thread overview]
Message-ID: <200110302129.WAA29040@pauillac.inria.fr> (raw)
In-Reply-To: <20011029112632.A22962@pauillac.inria.fr> from Xavier Leroy at "Oct 29, 101 11:26:32 am"

> > 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:
>         let rec f() = f();;
>         f () "bar";;
>         print_string (f());;
>         print_int (f());;
>         f() + 2;;
> 
> > 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.

Absolutely. This is particularly difficult if you consider that none
of those expressions can be generalized according to the current type
discipline (since, being applications, those expressions are
``expansive'' or equivalently they are not ``syntactic values''). So
the criterion to emit the warning would be even more complex and
unclear ...

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/
-------------------
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


  reply	other threads:[~2001-10-30 21:46 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 [this message]
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

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=200110302129.WAA29040@pauillac.inria.fr \
    --to=weis@pauillac.inria.fr \
    --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;
as well as URLs for NNTP newsgroup(s).