Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] [Q]: Co(ntra)variance and subtyping?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Clemens Hintze <cle-ocaml@q...>
Subject: Re: [Caml-list] Re: [Q]: Co(ntra)variance and subtyping?
On Sun, Nov 18, 2001 at 10:17:51AM +1100, Mark Wotton wrote:

(...)

> This way, you can take "t list" and add either "t" or "t'" to the
> front. Therefore, "t list" can do anything that "t' list" can, and
> the intuitive notion of subtypes is preserved.

Ahh ... I have the slight feeling, that I slowley get it ... thank
you. But I have to ask some more qustions to be sure ...

- In the context you have mentioned above: 'invariant' means the two
  types have *no* relationship to each other, yes?
- If you believe that contravariance isn't generally particularly
  useful, as you stated in the mail before, why can I flag some type
  with (-'a) stating this is contravariant? What sense does this make?  
- What exactly are types and subtypes in OCaml? You know, I am coming
  mainly from the imperative world. There I use languages that makes
  no distinction between classes and types. Is 'int' a subtype of
  'float'? How can I decide if something is a subtype of another one?
  I do not ask in sense of OO inheritance but in OCaml terminology.
  
> Apologies for getting it wrong the first time. It's doubly
> embarrassing as it seems I made the same mistake in the thesis I
> just handed in...

Its ok for me that you get it wrong, because so I could detect the
flaw and ensure myself that I am of the way of understanding. But that
you probably had made same mistake in thesis is really unfortunate for
you, and I feel a pity therefore :-(


Thanks again and ciao,
Clemens.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr