|Anonymous | Login | Signup for a new account||2017-10-22 08:23 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005337||OCaml||typing||public||2011-08-15 19:22||2016-12-08 15:37|
|Target Version||Fixed in Version|
|Summary||0005337: variance not inferred for package type|
|Description||OCaml doesn't accept the following program, because it does not infer that type [t] is|
module type S = sig
val x : t
type +'a t = (module S with type t = 'a)
It would be nice if OCaml's variance inference would look inside package types.
|Tags||No tags attached.|
Note that this also fails in 3.12.1
# module type S = sig type t val x : t end;;
module type S = sig type t val x : t end
# type +'a t = (module S with type t = 'a);;
Error: In this definition, expected parameter variances are not satisfied.
The 1st type parameter was expected to be covariant,
but it is invariant
Unfortunately, there is no cheap solution.
Computing the variance of a module would require going through all syntactic constructs, which probably means a huge number of lines of code.
An easy workaround is to use objects in place of first-class modules, at least when you need variance :-)
|Jacques: is this ever going to be fixed?|
A fix would require a breakthrough in our understanding of the interaction between modules and variance.
So I see no general fix anytime soon.
|For things like this I wonder if we should have a "known list of limitations" to which these items can be added, rather than keeping Mantis issues open for many years. Is there anything like that (or could we start something like that?) for the type checker?|
|2011-08-15 19:22||sweeks||New Issue|
|2011-08-15 19:54||yminsky||Note Added: 0006090|
|2011-12-10 04:13||garrigue||Assigned To||=> garrigue|
|2011-12-10 04:13||garrigue||Status||new => assigned|
|2011-12-10 04:16||garrigue||Note Added: 0006220|
|2011-12-10 04:16||garrigue||Status||assigned => acknowledged|
|2012-07-10 13:59||doligez||Severity||minor => feature|
|2016-12-07 16:37||shinwell||Note Added: 0016726|
|2016-12-07 16:38||shinwell||Status||acknowledged => assigned|
|2016-12-07 16:44||yallop||Relationship added||related to 0007151|
|2016-12-07 17:52||shinwell||Category||OCaml general => OCaml typing|
|2016-12-08 08:52||garrigue||Note Added: 0016816|
|2016-12-08 10:21||shinwell||Note Added: 0016829|
|2017-02-23 16:45||doligez||Category||OCaml typing => typing|
|Copyright © 2000 - 2011 MantisBT Group|