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 XAA01977; Sun, 5 Aug 2001 23:38:58 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA01921 for ; Sun, 5 Aug 2001 23:38:57 +0200 (MET DST) Received: from localhost.localdomain (ppp100.dyn146.pacific.net.au [210.23.146.100]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f75Lcsb23105 for ; Sun, 5 Aug 2001 23:38:54 +0200 (MET DST) Received: from maxtal.com.au (IDENT:root@localhost [127.0.0.1]) by localhost.localdomain (8.9.3/8.8.7) with ESMTP id HAA04050; Mon, 6 Aug 2001 07:37:30 +1000 Message-ID: <3B6DBC9A.1E6B82A2@maxtal.com.au> Date: Mon, 06 Aug 2001 07:37:30 +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: md5i@cs.cmu.edu CC: Caml-list Subject: Re: [Caml-list] Please help a newbie References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk md5i@cs.cmu.edu wrote: > > Johann Spies writes: >(BTW, in OCaml, the type unit is > sort of equivilent to C's void.) As an aside: in Felix, there are two types, unit (which has a single value, the empty tuple), and void, which has no values. The two are distinct (indeed, dual): unit is the categorical terminal, void is the categorical initial. In Ocaml, the categorical initial also exists, thanks to polymorphic variants: type void = [] It is my contention that the type of procedures is wrong in ocaml precisely because they return unit, when they _should_ be returning void (that is, nothing). An example of the kind of thing this typing permits is: let f () = print_endline "Hi" in f ( f() ) This works, because the type of f is unit -> unit instead of what it should be: unit -> void I note that the sequencing operator ; in such a system can't work correctly with the type (;): unit -> unit -> unit used in Ocaml. It can't be translated to (;): void -> void -> void but has to be translated to (;): (unit->void) -> (unit->void) -> (unit->void) which means the result is never actually executed. You need (;;): unit->void->void for that, and call it a stamement: statements can be concatenated, there cannot be a 'functional' way to execute statements in sequence, which provides a division between expressions and statements. I'm experimenting with a coherent syntax for this in Felix (which distinguishes expressions from statements, and functions from procedures). -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 New generation programming language Felix http://felix.sourceforge.net Literate Programming tool 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