Local modules are usually "safe" in the sense that the type system checks that the local types do not escape the whole expression.
I expect this is bad coding style, and should not be relied on. However,
I was surprised at the behavior, and wondered whether it was intended:
# let f = fun (type t) x ->
let module M = struct exception E of t end in
M.E x;;
val f : 'a -> exn = <fun>
f is polymorphic, as we expect:
# f 1;;
- : exn = E 1
# f "s";;
- : exn = E "s"
But now notice:
# f ();;
- : exn = E 0
# f None;;
- : exn = E 0
It appears that non-heap values are always getting magicked into ints.
Has this been noted before?
--
Jim Pryor
profjimm@jimpryor.net
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs