Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic of "include" constructs differs from the documentation specification #4488

vicuna opened this Issue Jan 23, 2008 · 1 comment


None yet
1 participant
Copy link

vicuna commented Jan 23, 2008

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 = ()


  • : 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.


-- Nicolas Barnier


This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 7, 2012

Comment author: @damiendoligez

This is clearly done on purpose. The inclusion is semantic rather than textual.

Fixed the documentation in trunk [3.13.0] (commit 12139)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.