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 XAA18286; Fri, 23 Mar 2001 23:51:10 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 XAA18591 for ; Fri, 23 Mar 2001 23:51:09 +0100 (MET) Received: from mail1.microsoft.com (mail1.microsoft.com [131.107.3.125]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id f2NMp8X11972 for ; Fri, 23 Mar 2001 23:51:08 +0100 (MET) Received: from 157.54.9.101 by mail3.microsoft.com (InterScan E-Mail VirusWall NT); Fri, 23 Mar 2001 12:32:16 -0800 (Pacific Standard Time) Received: from red-msg-04.redmond.corp.microsoft.com ([157.54.12.74]) by inet-imc-01.redmond.corp.microsoft.com with Microsoft SMTPSVC(5.0.2195.2883); Fri, 23 Mar 2001 12:33:52 -0800 X-MimeOLE: Produced By Microsoft Exchange V6.0.4418.65 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] recursive modules redux, & interface files Date: Fri, 23 Mar 2001 12:33:51 -0800 Message-ID: <0C682B70CE37BC4EADED9D375809768A48FD7A@red-msg-04.redmond.corp.microsoft.com> Thread-Topic: [Caml-list] recursive modules redux, & interface files Thread-Index: AcCyNsRrORVF4Zw/SliAAgx19fvPwQBnrAkw From: "Don Syme" To: "Xavier Leroy" , "Chris Hecker" Cc: X-OriginalArrivalTime: 23 Mar 2001 20:33:52.0023 (UTC) FILETIME=[9299BA70:01C0B3D8] Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > A possible approach for Caml would be to have a link-time analysis > that detects cross-module value recursions that involve only function > definitions, and allow these (because they are safe -- like in C!). > Fabrice Le Fessant posted a patch to OCaml a while ago that does > pretty much this. I'm still hoping more general, principled solutions > exist, but they sure are hard to design! Isn't it feasible to annotate elements of signatures with something that indicates that an identifier really is bound to a value, rather than a module?? i.e. foo.mli: value f : int -> int (* must be bound to a lambda expression or an identifier in foo.ml *) value x : int list (* must be bound to a cons-cell or an identifier in foo.ml *) expr g : int -> int (* may be a computation *) (The current "val" would be interpreted as "expr". "value" could also be replaced by "const" or "val rec" or "rec" or whatever) =20 I know this is revealing part of how foo.mli is implemented, but that is really the point: allow the programmer to reveal more when necessary to prove that things are safe. I guess you'd have to generalize this to functors, etc., (the subsumption relation between signatures would allow "values" to be used as "expressions", but not vice-versa). =20 Hasn't there been some work done one such "phase distinction" rules? Was that by Harper et al.?=20 However, this would not solve the problem: A.mli val x : int B.mli val y : int A.ml let x =3D B.y B.ml let y =3D A.x Perhaps disallowing identifiers on the r.h.s. (as in "let rec") is the right thing to do, even if a bit of pain when just rebinding function values. Cheers, Don ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr