Modern object-oriented languages make use of complex subtype relations. Consider julia programming language: it has user-defined invariant parametric types, existential types, union and covariant product types, as wel...
详细信息
ISBN:
(纸本)9781450359399
Modern object-oriented languages make use of complex subtype relations. Consider julia programming language: it has user-defined invariant parametric types, existential types, union and covariant product types, as well as some ad hoc rules, like the diagonal rule, facilitating the use of the core mechanism of the language - multiple dispatching. Its subtyping relation had no rigorous description so far, is implemented in 2KLOC of highly-optimized C code touched by only a handful of core developers, and perceived by the community as a black box. Examples sending the algorithm into a loop or crushing the VM keep poping up on the issue tracker. To tame the complexity, some time ago, we aimed for a formal definition of the relation, accompanied with the implementation. But how can we be sure that our implementation indeed corresponds to the cryptic C one? To solve that, we collected a large number of examples of subtype checks from the live julia sessions and compared the output with that of our implementation's. It would be more enlightening, however, to learn how to generate pairs of julia types which are likely to be in subtype relation to feed those into the testing framework. More interestingly, to learn the subtype algorithm itself.
暂无评论