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
Module signature depends of order of definition #8034
Comments
Comment author: administrator From: fillatre@noos.fr
Short answer: Yes. This is not a bug: at least for the bytecode interpreter, a module is Note however that you can coerce a module to a signature with a Jacques Garrigue |
Comment author: administrator
Note that "merge" uses the two functions "<" and ">". These are the
Then "merge" will use your "<" and ">" functions, which do not have Your two modules define different functions because the order of -- Damien |
Comment author: administrator
Short answer: yes it depends. But this is irrelevant to your ``problem'' In your first module you define merge before defining ( < ) and ( > ). In the second module, you define ( < ) and ( > ) before defining The compiler correctly flagged the type assignments consequences of So there is nothing strange here, just regular Caml semantics :) Thanks for the ``bug'' report and your interest for Caml. Pierre Weis.
|
Original bug ID: 1563
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: eric fillatre
Version: ocaml version 3.06
OS: windows 2000
Submission from: curie.noos.net (212.198.0.93)
Module signature depends of order of definitions
I define a Foo module
module Foo =
struct
type 'a t = {min : 'a ; max : 'a}
end
if i load it in the ocaml interpreter, i obtain the following signature :
module Foo :
sig
type 'a t = { min : 'a; max : 'a; }
val merge : 'a t -> 'a t -> 'a t
val ( < ) : 'a t -> 'a t -> bool
val ( > ) : 'a t -> 'a t -> bool
end
if now i change the order of definitions :
module Foo =
struct
type 'a t = {min : 'a ; max : 'a}
end
if i load it in the ocaml interpreter, i obtain a different signature (see
merge) :
module Foo :
sig
type 'a t = { min : 'a; max : 'a; }
val ( < ) : 'a t -> 'a t -> bool
val ( > ) : 'a t -> 'a t -> bool
val merge : 'a t t -> 'a t t -> 'a t t
end
The text was updated successfully, but these errors were encountered: