caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: OCAML <caml-list@inria.fr>
Subject: Re: [Caml-list] p4 (newbie) question
Date: Tue, 22 Jan 2002 09:47:14 +0100	[thread overview]
Message-ID: <20020122094714.B1462@verdot.inria.fr> (raw)
In-Reply-To: <86d703r2cg.fsf@speakeasy.org>; from itz@speakeasy.org on Mon, Jan 21, 2002 at 10:22:23AM -0800

Hi,

On Mon, Jan 21, 2002 at 10:22:23AM -0800, Ian Zimmerman wrote:

> shouldn't there be 2 distinct nodes like this
> 
> <:expr< $e1$ . $e2$ >> : access in records
> <:expr< $me1$ . $e2$ >> : access in modules

No: in these two quotations, e1, e2, me1, e2 are not some kind of
"keywords" like you seem to believe, but variables. These quotations
are (resp.) equivalent to:
       MLast.ExAcc (loc, e1, e2)
       MLast.ExAcc (loc, me1, e2)
which cannot discriminate according to the cases record/modules as
you see.

The difference is done by the first parameter when it represents (or
not) an uppercase identifier:
       MLast.ExAcc (loc, MLast.ExUid loc s, e2)
which can be written with quotations as:
       <:expr< $uid:s$ . $e2$ >>

That is (above) the code of contructing a module access if s is a
string holding the module name and e2 is an expression. If you already
know the name of your module, and if it is e.g. Foo, you can write it:
       <:expr< Foo . $e2$ >>
which is equivalent to:
       MLast.ExAcc (loc, MLast.ExUid loc "Foo", e2)

Note that you don't need to know the form with MLast.ExAcc, MLast.ExUid
and so on, but it is just to explain you what the quotations represent.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
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


  reply	other threads:[~2002-01-22  8:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-21 18:22 Ian Zimmerman
2002-01-22  8:47 ` Daniel de Rauglaudre [this message]
2002-01-22 14:46   ` Ian Zimmerman
2002-01-22 15:05     ` Daniel de Rauglaudre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020122094714.B1462@verdot.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).