You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5388 Reporter: furuse Assigned to:@garrigue Status: closed (set by @xavierleroy on 2013-08-31T10:44:02Z) Resolution: not fixable Priority: normal Severity: major Version: 3.12.1 Category: ~DO NOT USE (was: OCaml general) Monitored by:@gasche
Bug 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.
The text was updated successfully, but these errors were encountered:
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
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.
Original bug ID: 5388
Reporter: furuse
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2013-08-31T10:44:02Z)
Resolution: not fixable
Priority: normal
Severity: major
Version: 3.12.1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @gasche
Bug 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.
The text was updated successfully, but these errors were encountered: