Bug#418634: ocamlcp can break polymorphism (causing type error)
Package: ocaml
Version: 3.09.2-9
Severity: normal
I expect this is an upstream bug.
--- BEGIN EXAMPLE
(*
As of ocaml 3.09.2, the following code will compile fine, except when
compiled with ocamlpc -p i
$ ocamlcp -p i bug1.ml
File "/tmp/camlppd5deba", line 11, characters 8-160:
The type of this expression, ('_a, out_channel, unit) format -> '_a,
contains type variables that cannot be generalized
*)
let p = if true then Printf.printf else Printf.eprintf
--- END EXAMPLE
Basically, the problem is that ocamlcp calls ocamlprof as a preprocessor,
which translates that let into:
let p = if true then (OCAML__prof_Profiling.incr __ocaml_prof_bug1_cnt 0; Printf.printf) else (OCAML__prof_Profiling.incr __ocaml_prof_bug1_cnt 1; Printf.eprintf)
Which breaks, AFAICT because of the value restriction. (Because
(();x) isn't polymorphic, even when x is.)
Thanks,
Ivan
-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-2-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages ocaml depends on:
ii ocaml-base [ocaml-base-3.09.2 3.09.2-9 Runtime system for ocaml bytecode
ii ocaml-nox [ocaml-nox-3.09.2] 3.09.2-9 ML language implementation with a
ocaml recommends no packages.
-- no debconf information
Reply to: