Version française
Home     About     Download     Resources     Contact us    
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 <henridf@lcavsun1.epfl.ch>

> 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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners