Browse thread
[Caml-list] syntax of private constructors in CVS version
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Max Skaller <skaller@o...> |
| Subject: | Re: [Caml-list] syntax of private constructors in CVS version |
Pierre Weis wrote:
> Records with mutable fields are permitted. Mutators explicitely exported
> as functions are allowed, other mutations are forbidden.
...
> type rat = {
> mutable numerator : int;
> mutable denominator : int;
> };;
> Then interface of the module would abstract creation and mutation:
>
> type rat = private {
> mutable numerator : int;
> mutable denominator : int;
> };;
>
> val mk_rat : int -> int -> rat;;
> val normalize_rat : rat -> unit;;
OK. Nice. 'private' is allowed in the interface, and matches
a non-private record defined in the module. [I imagine
generated accessor and mutators here .. a field label
just being shorthand way to specify a projection function
etc ..]
--
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners