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 PAA30849; Tue, 22 Jan 2002 15:46:36 +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 PAA30461 for ; Tue, 22 Jan 2002 15:46:35 +0100 (MET) Received: from mail12.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g0MEkYD27970 for ; Tue, 22 Jan 2002 15:46:34 +0100 (MET) Received: (qmail 20797 invoked from network); 22 Jan 2002 14:46:33 -0000 Received: from unknown (HELO kronstadt) ([64.81.49.223]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 22 Jan 2002 14:46:33 -0000 Received: from itz by kronstadt with local (Exim 3.33 #1 (Debian)) id 16T2C0-00087G-00 for ; Tue, 22 Jan 2002 06:46:32 -0800 To: caml-list@inria.fr (OCAML) Subject: Re: [Caml-list] p4 (newbie) question References: <86d703r2cg.fsf@speakeasy.org> <20020122094714.B1462@verdot.inria.fr> From: Ian Zimmerman Date: 22 Jan 2002 06:46:32 -0800 In-Reply-To: <20020122094714.B1462@verdot.inria.fr> Message-ID: <863d0yzbnb.fsf@speakeasy.org> User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk itz> shouldn't there be 2 distinct nodes like this itz> itz> <:expr< $e1$ . $e2$ >> : access in records itz> <:expr< $me1$ . $e2$ >> : access in modules Daniel> No: in these two quotations, e1, e2, me1, e2 are not some kind Daniel> of "keywords" like you seem to believe, but variables. These Daniel> quotations are (resp.) equivalent to: Daniel> MLast.ExAcc (loc, e1, e2) Daniel> MLast.ExAcc (loc, me1, e2) Daniel> which cannot discriminate according to the cases Daniel> record/modules as you see. Well, I guess I can rephrase my question then: shouldn't there be both MLast.ExRecAcc (loc, e1, e2) and MLast.ExModAcc (loc, me1, e2) ? After all, doesn't p4 have to pass distinct trees to the compiler proper in these two cases? Daniel> The difference is done by the first parameter when it Daniel> represents (or not) an uppercase identifier: Daniel> MLast.ExAcc (loc, MLast.ExUid loc s, e2) Daniel> which can be written with quotations as: Daniel> <:expr< $uid:s$ . $e2$ >> Daniel> That is (above) the code of contructing a module access if s Daniel> is a string holding the module name and e2 is an Daniel> expression. If you already know the name of your module, and Daniel> if it is e.g. Foo, you can write it: Daniel> <:expr< Foo . $e2$ >> But I don't know the name like that, it is not fixed; I am trying to parse that as well. So my me1 can be any module access path in general (OK, no functor applications for now, but arbitrary depth). It would be a different story if the dot were right-associative; then, indeed, I could write something like let barexp = <:expr< Bar . $exp$ >> in <:expr< Foo . $barexp$ >> But this is ungrammatical; normal ocaml grammar says that Foo.Bar.exp is to be parsed as (Foo.Bar).exp Antoher question, and one I am afraid I know the answer to: where/what is the quotation for applicative record update {foo with bar = expr} ? -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 In his own soul a man bears the source from which he draws all his sorrows and his joys. Sophocles. ------------------- 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