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

references #8088

Closed
vicuna opened this issue Apr 4, 2003 · 3 comments
Closed

references #8088

vicuna opened this issue Apr 4, 2003 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Apr 4, 2003

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

Bug description

Full_Name: Christophe Poucet
Version: 3.06
OS: Windows
Submission from: ncasse01.telenet-ops.be (213.224.83.38)

When using ref's sometimes it will change the type specification of the
monomorphic type yet not add the given param, perhaps this will explain better:

let x = ref[];;

val x : '_a list ref = {contents = []}

x := (function y -> y)::!x;;

x;;

  • : ('_a -> '_a) list ref = {contents = []}

x := (function f -> f f)::!x;;

Characters 22-23:
x := (function f -> f f)::!x;;
^
This expression has type 'a -> 'b but is here used with type 'a

x;;

  • : (('_a -> '_b) -> '_a -> '_b) list ref = {contents = []}

It -does- change the type of x, yet it doesn't add the function to the list....

Is this a bug, or am I missing something?

Christophe Poucet

@vicuna
Copy link
Author

vicuna commented Apr 5, 2003

Comment author: administrator

From: christophe.poucet@pandora.be

When using ref's sometimes it will change the type specification of the
monomorphic type yet not add the given param, perhaps this will
explain better:
[...]
You are talking about cases where type inference fails, so no code is
executed, yet types are modified.

Is this a bug, or am I missing something?

This is not a bug: the semantics of monomorphic free type variables is
not well defined anyway.

But the next version of the compiler is able to do backtracking in the
toplevel:
Objective Caml version 3.06+27 (2003-03-31)

let x = ref[];;

val x : '_a list ref = {contents = []}

x := (function y -> y)::!x;;

  • : unit = ()

x;;

  • : ('_a -> '_a) list ref = {contents = []}

x := (function f -> f f)::!x;;

This expression has type 'a -> 'b but is here used with type 'a

x;;

  • : ('_a -> '_a) list ref = {contents = []}

So this non-bug is already fixed :-)

Jacques

@vicuna
Copy link
Author

vicuna commented Apr 5, 2003

Comment author: administrator

[...]

Is this a bug, or am I missing something?

This is not a bug: the semantics of monomorphic free type variables is
not well defined anyway.

The semantics of what you call ``monomorphic free type variables'' is
indeed well defined: there are just plain regular type variables as
maintained and routinely used by the typechecker. Nothing strange or
mysterious there. Anyway:

[...]

So this non-bug is already fixed :-)

So may be people will no more ask about those type variables (as
opposed to type schemes parameters with which they are often confused).

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/

@vicuna
Copy link
Author

vicuna commented May 5, 2003

Comment author: administrator

Works as expected in 3.06+27

@vicuna vicuna closed this as completed May 5, 2003
@vicuna vicuna mentioned this issue Mar 14, 2019
@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