| Anonymous | Login | Signup for a new account | 2013-05-19 15:43 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0005337 | OCaml | OCaml general | public | 2011-08-15 19:22 | 2012-07-10 13:59 | ||||||
| Reporter | sweeks | ||||||||||
| Assigned To | garrigue | ||||||||||
| Priority | normal | Severity | feature | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 3.12.0 | ||||||||||
| 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 covariant. module type S = sig type t val x : t end 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. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0006090) yminsky (reporter) 2011-08-15 19:54 |
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 |
|
(0006220) garrigue (manager) 2011-12-10 04:16 |
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 :-) |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 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 |
| Copyright © 2000 - 2011 MantisBT Group |