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 LAA20613; Wed, 13 Jun 2001 11:56:32 +0200 (MET DST) 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 LAA20567 for caml-list@pauillac.inria.fr; Wed, 13 Jun 2001 11:56:31 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA07881 for ; Tue, 12 Jun 2001 19:55:30 +0200 (MET DST) Received: from localhost.localdomain (ppp138.dyn146.pacific.net.au [210.23.146.138]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f5CHtRb17987 for ; Tue, 12 Jun 2001 19:55:28 +0200 (MET DST) Received: from ozemail.com.au (IDENT:root@localhost [127.0.0.1]) by localhost.localdomain (8.9.3/8.8.7) with ESMTP id DAA08910; Wed, 13 Jun 2001 03:55:15 +1000 Message-ID: <3B265783.C386F97@ozemail.com.au> Date: Wed, 13 Jun 2001 03:55:15 +1000 From: John Max Skaller X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Dave Mason CC: David McClain , caml-list@inria.fr Subject: Re: [Caml-list] Evaluation Order References: <200106111303.JAA14369@sarg.Ryerson.CA> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Dave Mason wrote: > I think the answer is that the ``effect''ness isn't simply captured in > the type. So the current type-inference engine would not be able to > do it. It would require a bit of ad-hocery in the compiler. That > doesn't mean that it's unsound, just that the existing compiler > mechanisms couldn't do it. I think you probably _have_ to capture it in the type. Consider a new type 'a => 'b where '=>' means 'function with side effects'. Now consider the following two term constructors: Apply(fn1,arg1) Init(name,fn2,arg2) The type-checking rules are then clear: fn1: 'a->'b, arg1:'a, Apply(fn1,arg1):'b fn2: 'a=>'b, arg2:'a, name: 'b and 'a->'b is a subtype of 'a=>'b' In Felix it would be easy to verify correct usage, but I'm not sure it is possible to verify correct specification. In Ocaml, it may be harder, since one can use a function before declaration in a 'let rec', and it may be too late when spotting the type annotation to report a wrong usage. [OTOH, if the Ocaml compiler scanned 'let recs' for type annotations before examining bodies, it might improve error reporting in other circumstances??] -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net ------------------- 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