You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4488 Reporter: barnier Status: closed (set by @damiendoligez on 2012-02-07T14:44:03Z) Resolution: fixed Priority: normal Severity: minor Version: 3.10.0 Fixed in version: 3.13.0+dev Category: documentation Monitored by: "Julien Signoles" jm
Bug description
In the documentation, it is specified that including:
module S = struct type t = int let x = 2 end
in another module:
struct include S let y = (x + 1 : t) end
is equivalent to write:
struct type t = int let x = 2 let y = (x + 1 : t) end
However it is clearly not the case whenever side-effects
are involved as in the following example:
barnier@beige:~$ ocaml
Objective Caml version 3.10.0
module M = struct let v = ref 1 end;;
module M : sig val v : int ref end
module T = struct include M end;;
module T : sig val v : int ref end
M.v := 2;;
: unit = ()
T.v;;
: int ref = {contents = 2}
I don't know if the bug is in the doc or in the compiler,
but if it is the documentation, I would say that include
constructs are equivalent to write something like :
module T = struct let v = M.v end
which is quite different IMHO.
Regards
-- Nicolas Barnier
The text was updated successfully, but these errors were encountered:
Original bug ID: 4488
Reporter: barnier
Status: closed (set by @damiendoligez on 2012-02-07T14:44:03Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.10.0
Fixed in version: 3.13.0+dev
Category: documentation
Monitored by: "Julien Signoles" jm
Bug description
In the documentation, it is specified that including:
module S = struct type t = int let x = 2 end
in another module:
struct include S let y = (x + 1 : t) end
is equivalent to write:
struct type t = int let x = 2 let y = (x + 1 : t) end
However it is clearly not the case whenever side-effects
are involved as in the following example:
barnier@beige:~$ ocaml
Objective Caml version 3.10.0
module M = struct let v = ref 1 end;;
module M : sig val v : int ref end
module T = struct include M end;;
module T : sig val v : int ref end
M.v := 2;;
T.v;;
I don't know if the bug is in the doc or in the compiler,
but if it is the documentation, I would say that include
constructs are equivalent to write something like :
module T = struct let v = M.v end
which is quite different IMHO.
Regards
-- Nicolas Barnier
The text was updated successfully, but these errors were encountered: