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
[Caml-list] coercing to a #-type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] coercing to a #-type
From: Henri Dubois-Ferriere <>

> can coercing an object to a #-type ever change the type of the object?
> [i tried to come up with some instance where this would happen, but could 
> not, and on thinking about it i would guess that since a #-type is 'open', 
> it makes no sense to coerce to such a type.]

What do you mean by "coercing"?
If you mean (o :> #a), then indeed it is pointless, as it is just
equivalent to (o : #a) (no subtyping is introduced).

> A somewhat related question:
> class a = object method bla = 1 end
> are the types 
> #a
> and 
> < bla : int; ..> 
> equivalent? (in the sense that using on instead of the other will 
> always give identical results)

Indeed they are equivalent. #a is just a convenience to make printed
types more readable.

      Jacques Garrigue

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: