From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA23970; Mon, 29 Oct 2001 11:47:11 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA23460 for caml-list@pauillac.inria.fr; Mon, 29 Oct 2001 11:47:10 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA23195; Mon, 29 Oct 2001 11:26:32 +0100 (MET) Date: Mon, 29 Oct 2001 11:26:32 +0100 From: Xavier Leroy To: Pixel Cc: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] raise extra arg ignored Message-ID: <20011029112632.A22962@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from pixel@mandrakesoft.com on Sat, Oct 27, 2001 at 09:51:05PM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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. - Xavier Leroy ------------------- 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