Date: Thu, 28 Jan 1999 20:40:48 +0100
Message-Id: <199901281940.UAA01127@irritatie.cs.kun.nl>
From: Hendrik Tews <tews@irritatie.cs.kun.nl>
To: caml-list@inria.fr
Subject: Re: subtyping and inheritance
In-Reply-To: <19990127151827.16711@pauillac.inria.fr>
<199901250008.BAA29432@miss.wu-wien.ac.at>
Hi,
I don't know how method dispatch is implemented in ocaml. I was
also not able to find a reference about that (is their such?).
Therefore the following is based on some speculation.
From: Jerome Vouillon <Jerome.Vouillon@inria.fr>
Date: Wed, 27 Jan 1999 15:18:27 +0100
Subject: Re: subtyping and inheritance
[concerning covariant method specialization]
However, it is not possible to apply this extension to Ocaml. Indeed,
it requires that methods are chosen depending on the dynamic type of
their arguments. But this information is not available in Ocaml.
There are also difficulties for type inference.
But also in ocaml you choose the method depending on the dynamic
type of object to which it is applied (otherwise late binding
could never work). You only had to repeat this process for all
the arguments of the method which are declared for covariant
specialization.
The absence of dynamic types applies only to arguments which are
not objects. But since other types (than object types) cannot be
related by the subtype relation, covariant specialization would
never apply for such arguments.
Surly, there would be some difficulties to integrate this
feature. But compare that with the gain! Compare those clumsy
solutions to Markus' problem with the ease of simly overriding
the binary method! Being able to really use binary methods in a
type safe environment would IMHO be worth a lot of effort.
Bye,
Hendrik
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:19 MET