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

problem with some type generalization with ocaml compilers #3898

Closed
vicuna opened this issue Nov 30, 2005 · 1 comment
Closed

problem with some type generalization with ocaml compilers #3898

vicuna opened this issue Nov 30, 2005 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Nov 30, 2005

Original bug ID: 3898
Reporter: philippe_wang
Status: closed (set by @damiendoligez on 2005-12-01T09:23:12Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.09.0
Category: ~DO NOT USE (was: OCaml general)

Bug description

the ocaml binary program accepts and executes without any warning or error this :

let ($),(/),(^),c = Thread.create,print_string,(fun _->flush stdout), ref 0

but ocamlopt and ocamlc refuse to compile it because of type variables that cannot be generalized.

Additional information

A file starting with this line :
let ($),(/),(^),c = Thread.create,print_string,(fun _->flush stdout), ref 0
returns :

shell_prompt> ocamlc -thread unix.cma threads.cma foo.ml
File "foo.ml", line 1, characters 20-75:
The type of this expression,
((unit -> '_a) -> unit -> Thread.t) * (string -> unit) * (unit -> unit) *
int ref, contains type variables that cannot be generalized

With the interactive mode :
shell_prompt> ocaml -I +threads unix.cma threads.cma
Objective Caml version 3.09.0

let ($),(/),(^),c = Thread.create,print_string,(fun _->flush stdout), ref 0 ;;

val ( $ ) : ('_a -> '_b) -> '_a -> Thread.t =
val ( / ) : string -> unit =
val ( ^ ) : '_a -> unit =
val c : int ref = {contents = 0}

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