From: Keiko Nakata <keiko@kurims.kyoto-u.ac.jp>
To: shawjef3@msu.edu
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] restricting and hiding record fields for functors
Date: Fri, 04 Jan 2008 19:09:57 +0900 (JST) [thread overview]
Message-ID: <20080104.190957.68544872.keiko@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <477DED41.3040009@msu.edu>
Hello.
Maybe private row types are useful to you;
see the Language extensions section of the OCaml manual:
http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html
You can do something like this:
module M = struct
type t = < x:int; y:int>
let r = object method x = 1 method y = 2 end
end;;
module F(X:sig type t = private <x:int; ..> val r: t end) =
struct let x = X.r#x end;;
module FM = F(M);;
let x = FM.x;;
I often prefer to use a syntax extension,
found at http://www.math.nagoya-u.ac.jp/~garrigue/code/ocaml.html,
which allows me to write
let r = {| x = 1 method y = 2 |}
instead of
let r = object method x = 1 method y = 2 end
With best regards,
Keiko
prev parent reply other threads:[~2008-01-04 10:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-04 8:24 Jeff Shaw
2008-01-04 10:09 ` Keiko Nakata [this message]
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=20080104.190957.68544872.keiko@kurims.kyoto-u.ac.jp \
--to=keiko@kurims.kyoto-u.ac.jp \
--cc=caml-list@inria.fr \
--cc=shawjef3@msu.edu \
/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