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

"and" du "module rec" non commutatif #8132

Closed
vicuna opened this issue May 5, 2003 · 1 comment
Closed

"and" du "module rec" non commutatif #8132

vicuna opened this issue May 5, 2003 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented May 5, 2003

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

@vicuna
Copy link
Author

vicuna commented May 25, 2003

Comment author: administrator

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.

@vicuna vicuna closed this as completed May 25, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant