Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] p4 (newbie) question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-01-22 (08:47)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] p4 (newbie) question

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.

Bug reports:  FAQ:
To unsubscribe, mail  Archives: