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: 1671 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Julien Signoles
Version: cvs, tag recursive_module
OS: Linux
Submission from: newwww.lri.fr (129.175.15.10)
Bonjour,
=====
$ cat foo.ml
module type MT = sig val f : int -> int end
module rec B : MT = struct let f x = x end
and A : MT = struct let f = B.f end (* l'appel a B.f est apres la definition de
B )
let _ = Printf.printf "%d\n" (A.f 5)
$ ocamlopt -o foo foo.ml
$ ./foo
5
$ cat foo2.ml
module type MT = sig val f : int -> int end
module rec A : MT = struct let f = B.f end ( l'appel a B.f est avant la
definition de B *)
and B : MT = struct let f x = x end
let _ = Printf.printf "%d\n" (A.f 5)
$ ocamlopt -o foo2 foo2.ml
$ ./foo2
Fatal error: exception Undefined_recursive_module("foo2.ml", 4, 13)
Je pense qu'il n'est pas normal que le comportement soit different dans les 2
versions.
Il est a noter que si on eta-expanse A.f (i.e. "let f x = B.f x" dans A),
l'exception n'est jamais levee.
--
Julien Signoles
The text was updated successfully, but these errors were encountered:
This is normal behavior in the current design for recursive modules. "and"
cannot be commutative because the original ordering of evaluation is kept as
much as possible.
Original bug ID: 1671
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Julien Signoles
Version: cvs, tag recursive_module
OS: Linux
Submission from: newwww.lri.fr (129.175.15.10)
Bonjour,
=====
$ cat foo.ml
module type MT = sig val f : int -> int end
module rec B : MT = struct let f x = x end
and A : MT = struct let f = B.f end (* l'appel a B.f est apres la definition de
B )
let _ = Printf.printf "%d\n" (A.f 5)
$ ocamlopt -o foo foo.ml
$ ./foo
5
$ cat foo2.ml
module type MT = sig val f : int -> int end
module rec A : MT = struct let f = B.f end ( l'appel a B.f est avant la
definition de B *)
and B : MT = struct let f x = x end
let _ = Printf.printf "%d\n" (A.f 5)
$ ocamlopt -o foo2 foo2.ml
$ ./foo2
Fatal error: exception Undefined_recursive_module("foo2.ml", 4, 13)
Je pense qu'il n'est pas normal que le comportement soit different dans les 2
versions.
Il est a noter que si on eta-expanse A.f (i.e. "let f x = B.f x" dans A),
l'exception n'est jamais levee.
--
Julien Signoles
The text was updated successfully, but these errors were encountered: