Version française
Home     About     Download     Resources     Contact us    
Browse thread
include, functor and side-effect
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Julien Signoles <signoles@l...>
Subject: include, functor and side-effect
Hello,

The following code outputs "toto" (both with ocamlc and ocamlopt, test 
with 3.09.2): that's the normal behaviour of the "include" statement.

==========
module F(X:sig end) = struct let x = print_endline "toto" end
module G = struct include F(struct end) end
==========

But if you change "let x = ..." by "let () = ..." as follow, there is no 
more output:

==========
module F(X:sig end) = struct let () = print_endline "toto" end
module G = struct include F(struct end) end
==========

Do you consider this behaviour as a bug or as the normal behaviour of an 
"include" statement?

Note that if you substitute "include" by "module M = ", the code still 
outputs "toto".

Julien Signoles
-- 
mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles
"In theory, practice and theory are the same,
but in practice they are different" (Larry McVoy)