From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA27180 for caml-redistribution; Mon, 18 Oct 1999 16:13:35 +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 NAA16470 for ; Sun, 17 Oct 1999 13:21:00 +0200 (MET DST) Received: from ruby (pm1-0.triode.net.au [203.63.235.16]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id NAA11241; Sun, 17 Oct 1999 13:20:56 +0200 (MET DST) Received: from maxtal.com.au (IDENT:root@localhost [127.0.0.1]) by ruby (8.9.3/8.9.3) with ESMTP id VAA18965; Sun, 17 Oct 1999 21:15:04 +1000 Sender: weis Message-ID: <3809AFB8.F6CF5FB2@maxtal.com.au> Date: Sun, 17 Oct 1999 21:15:04 +1000 From: skaller Organization: Maxtal X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.12 i586) X-Accept-Language: en MIME-Version: 1.0 To: Pierre Weis CC: caml-list@inria.fr Subject: Re: Rebinding exception declarations References: <199910150712.JAA01968@pauillac.inria.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Pierre Weis wrote: > > Actually, I think there is a more syntactic problem: ocaml uses > > special 'kinds' of bindings, for some reason that escapes me: > > > > type X = .. > > class X = .. > > exception .. > > let X = .. > > let rec X = > > module X = > > > > which permit recursion with an 'and' option. Unfortunately, > > this syntax does not permit these kinds of bindings to be > > mutually recursive (quite aside from the semantic issues). > > Not aside from, but due to semantic issues. > > > I find this syntax strange, I would have expected > > > > let X = > > > > be enough for all kinds of bindings, determined by the > > kind of the right hand side. > > I understand: you start everything by let and then distinguish the > construction you are using by some keyword to determine the kind of > the right hand side. It would ressemble something like: > > let x = type .. > let c = class .. > let E = exception .. > let M = module .. > let _ = .. (for expression only) > > I think the regular syntax of Caml is simpler and more intuitive. But if that is the only argument, then your previous claim: > Not aside from, but due to semantic issues. is not quite correct. > Apart from syntax, once more it is a semantic problem: modules are not > values, values are not types, exception are not classes, classes are > not functors. We prefer to have a direct reflection of these semantics > distinctions in the syntax: we hope it may induce a clear distinction > in the programmer's ideas. I accept the intuition, but this leaves the problem that recursions between say, a class and an algebraic type, cannot be expressed directly using the 'and' option. Had the syntax been: let class X = .. and class Y = we could have added and type algebraic = .. There are cases where this can be proved to work. For example, by first abstracting the algebraic types out of the classes (making them type parameters), then declaring the algbraic types, and then instantiating the classes with the appropriate types. I'm not certain, but it seems this is general, so that mixing class and algebraic types recursively should be OK .. if only there were a syntax for it. -- John Skaller, mailto:skaller@maxtal.com.au 1/10 Toxteth Rd Glebe NSW 2037 Australia homepage: http://www.maxtal.com.au/~skaller downloads: http://www.triode.net.au/~skaller