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

Problème de typage des références dans les modules #3506

Closed
vicuna opened this issue Mar 2, 2005 · 2 comments
Closed

Problème de typage des références dans les modules #3506

vicuna opened this issue Mar 2, 2005 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 2, 2005

Original bug ID: 3506
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Benjamin Monate
Version: 3.08.2
OS: Linux
Submission from: is002447.saclay.cea.fr (132.166.134.145)

Bonjour,
Le programme suivant est refusé par le typage :
===pb.mli====
type t
val f : (t -> unit) ref

===pb.ml=====
let f = ref (fun _ -> raise Not_found)
type t = TOP

ocamlc -c pb.mli
ocamlc -c pb.ml
The implementation pb.ml does not match the interface pb.cmi:
Values do not match:
val f : ('_a -> '_b) ref
is not included in
val f : (t -> unit) ref

Si on inverse la déclaration de f et de t dans pb.ml, le typage réussit.

Est-ce bien un bug ?
Cordialement

@vicuna
Copy link
Author

vicuna commented Mar 3, 2005

Comment author: administrator

Full_Name: Benjamin Monate
Le programme suivant est refusé par le typage :
===pb.mli====
type t
val f : (t -> unit) ref

===pb.ml=====
let f = ref (fun _ -> raise Not_found)
type t = TOP

Ce n'est pas un bug. La reference f etant typee de facon monomorphe, elle est
sensee avoir un type defini au moment de sa definition, ce qui n'est pas le cas
ici.
On a le meme comportement au toplevel:

!f TOP;;

This expression has type t but is here used with type 'a
The type constructor t would escape its scope

Jacques

@vicuna
Copy link
Author

vicuna commented Mar 3, 2005

Comment author: administrator

portee des types construits

@vicuna vicuna closed this as completed Mar 3, 2005
@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