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
hiding the 'mutable' modifier
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thomas Colcombet <Thomas.Colcombet@i...>
Subject: hiding the 'mutable' modifier

I'd like to do something that looks like :

module A =
     type t = { mutable field : int }
  end : sig
     type t = { field : int }

This is not allowed by ocaml, however
I think it would be useful  if the mutable
field is modified, let's say, only during the
construction of terms of type t, but must not
be modified outside the module (for consistency
Is there any typing or implementation issue
which prevents such mutable modifier hiding ?