Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004488OCamlOCaml documentationpublic2008-01-23 11:452012-02-07 15:44
Reporterbarnier 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.10.0 
Target VersionFixed in Version3.13.0+dev 
Summary0004488: Semantic of "include" constructs differs from the documentation specification
DescriptionIn 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
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0006896)
doligez (administrator)
2012-02-07 15:44

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

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

- Issue History
Date Modified Username Field Change
2008-01-23 11:45 barnier New Issue
2008-02-19 15:18 doligez Status new => acknowledged
2012-02-07 15:44 doligez Note Added: 0006896
2012-02-07 15:44 doligez Status acknowledged => closed
2012-02-07 15:44 doligez Resolution open => fixed
2012-02-07 15:44 doligez Category OCaml general => OCaml documentation
2012-02-07 15:44 doligez Fixed in Version => 3.13.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker