| Anonymous | Login | Signup for a new account | 2013-05-26 01:59 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 | |||||||
| 0005388 | OCaml | OCaml general | public | 2011-10-26 20:34 | 2011-12-21 11:54 | |||||||
| Reporter | furuse | |||||||||||
| Assigned To | garrigue | |||||||||||
| Priority | normal | Severity | major | Reproducibility | always | |||||||
| Status | resolved | Resolution | not fixable | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | 3.12.1 | |||||||||||
| Target Version | Fixed in Version | |||||||||||
| Summary | 0005388: recursive class type definition via module rec misses some inheritance information | |||||||||||
| Description | The following code is not type-checked: ---------------------------- type 'a t type _Unicode type _String type _Sequence module rec M_Sequence : sig class type o_Sequence = object method _Sequence : _Sequence t end end = struct class type o_Sequence = object method _Sequence : _Sequence t end end and M_String : sig class type o_String = object inherit M_Sequence.o_Sequence method _String : _String t end end = struct class type o_String = object inherit M_Sequence.o_Sequence method _String : _String t end end and M_Unicode : sig class type o_Unicode = object inherit M_String.o_String method _Unicode : _Unicode t end end = struct class type o_Unicode = object inherit M_String.o_String method _Unicode : _Unicode t end end --------------- Saying: class type o_Unicode = object method _String : _String t method _Unicode : _Unicode t end The public method _Sequence cannot be hidden So, there is something strange around the conjunction of module rec and class inheritance. | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Notes |
|
|
(0006187) furuse (reporter) 2011-10-27 02:34 |
Now I have something simpler and working, but still the above example indicates a bug of computing the fixed point of inheritance... ------------------------------ type 'a t type _Unicode type _String type _Sequence module rec M : sig class type o_Sequence = object method _Sequence : _Sequence t end class type o_String = object inherit M.o_Sequence method _String : _String t end class type o_Unicode = object inherit M.o_String method _Unicode : _Unicode t end end = M |
|
(0006192) garrigue (manager) 2011-10-29 10:45 |
My understanding is that computation of fixpoints for recursive modules is incomplete, and cannot even be so from a theoretical point of view (impossible to know the number of iterations needed to reach a fixpoint). For classes, the algorithm is bootstrapped by starting from empty classes, which explains why inheritance doesn't work when the number of modules involved is too large. Since I don't see any complete solution coming, the best approach is to avoid inheritance between recursive modules. By the way, I don't know why your workaround using a single interface works, but this seems to scale for an arbitrary number of levels of inheritance. Good. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-10-26 20:34 | furuse | New Issue | |
| 2011-10-27 02:34 | furuse | Note Added: 0006187 | |
| 2011-10-29 10:45 | garrigue | Note Added: 0006192 | |
| 2011-12-21 11:54 | gasche | Status | new => resolved |
| 2011-12-21 11:54 | gasche | Resolution | open => not fixable |
| 2011-12-21 11:54 | gasche | Assigned To | => garrigue |
| Copyright © 2000 - 2011 MantisBT Group |