Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
type -'a obj
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: "ocaml_beginners"::[] type -'a obj
On Sat, Jul 05, 2003 at 02:11:35PM +0900, Yamagata Yoriyuki wrote:
> It is a variance. If type "t1" is a subtype of "t2", -'a obj tells
> you that "t2 obj" is a subtype of "t1 obj", so that you can coerce "t2
> obj" to "t1 obj". If the variance is positive "+'a t", then "t1 t"
> becomes a subtype of "t2 t".

I guess I may be completely missing the point of abstract types.

If I do:

# type 'a obj;;
type 'a obj

All well and good, but how can I ever create instances of this type?
If you can't create any instances, I don't understand how this could
ever be useful (or legal).


Richard Jones.
Merjis Ltd. - all your business data are belong to you.
"I wish more software used text based configuration files!"
-- A Windows NT user, quoted on Slashdot.