caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: caml-list@inria.fr
Subject: co(ntra)-variant subtyping
Date: Mon, 25 May 1998 13:46:19 +0200	[thread overview]
Message-ID: <199805251146.NAA21664@ithif18.inf.tu-dresden.de> (raw)
In-Reply-To: <19980522112157L.garrigue@kurims.kyoto-u.ac.jp>

Hi,
   
   Objective Caml's subtyping algorithm does not subtype under type
   constructors (but it does it under abbreviations), for the sake of
   efficiency. That is, eventhough colored_point :> point, you don't have
   colored_point option :> point option. This equation would be needed to
   check the subtyping in method move of example 2.
   
I must say I am really surprised.  

How about object types? Do they support co(ntra)-variant
subtype rules?

I would suggest to include a section about the subtype relation
in the ocaml documentation. Because IMHO anybody how knows
something about formal models for oo languages would expect
co(ntra)-variant subtype rules. 

In summary I think the lack of these subtype rules are a major
restriction of the ocaml language. Now it is not possible to mix
class types and (algebraic) data types in an application. Instead
a user has to decide beforehand what is more important for him:
algebraic data types and parametric polymorphism or object types
with code reuse and stepwise refinement.

Are there any plans to add the missing subtype rules to the type
system of ocaml?

Bye,

Hendrik





  reply	other threads:[~1998-05-25 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-20 15:00 Subtype problem Hendrik Tews
1998-05-22  2:21 ` Jacques GARRIGUE
1998-05-25 11:46   ` Hendrik Tews [this message]
1998-05-26  9:24     ` co(ntra)-variant subtyping Didier Remy
1998-06-04 15:17       ` Hendrik Tews
1998-06-04 18:29         ` Didier Remy
1998-06-05  5:45         ` Jacques GARRIGUE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199805251146.NAA21664@ithif18.inf.tu-dresden.de \
    --to=tews@tcs.inf.tu-dresden.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).