caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] coercing to a #-type
@ 2003-12-05 11:34 Henri Dubois-Ferriere
  2003-12-05 12:57 ` Jacques Garrigue
  0 siblings, 1 reply; 2+ messages in thread
From: Henri Dubois-Ferriere @ 2003-12-05 11:34 UTC (permalink / raw)
  To: caml-list

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.]


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)


Thanks
Henri

-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] coercing to a #-type
  2003-12-05 11:34 [Caml-list] coercing to a #-type Henri Dubois-Ferriere
@ 2003-12-05 12:57 ` Jacques Garrigue
  0 siblings, 0 replies; 2+ messages in thread
From: Jacques Garrigue @ 2003-12-05 12:57 UTC (permalink / raw)
  To: henri.dubois-ferriere; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-05 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-05 11:34 [Caml-list] coercing to a #-type Henri Dubois-Ferriere
2003-12-05 12:57 ` Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).