Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Gert Smolka <smolka@ps.uni-sb.de>
To: caml-list@inria.fr
Subject: Overriding with subtypes
Date: Mon, 30 Aug 1999 18:54:30 +0200	[thread overview]
Message-ID: <37CAB746.950F452C@ps.uni-sb.de> (raw)

It should be ok to override a method of type t
with a method of a subtype of  t.  In fact,
that happens in

class c  = object(self) method a = self end
class c' = object(self) inherit c method a = self method b = 1 end

since c' is a proper subtype of c.  This is accepted by
Ocaml.  However,

class d  = object method a = new c end
class d' = object inherit d method a = new c' end

is rejected.  Why?  I would expect that this is a
limitation that is due to the type inferencer.

Gert Smolka




             reply	other threads:[~1999-08-31 12:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-30 16:54 Gert Smolka [this message]
1999-08-31 13:48 ` Didier.Remy

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=37CAB746.950F452C@ps.uni-sb.de \
    --to=smolka@ps.uni-sb.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