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] about Obj.magic
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Warp <warplayer@f...>
Subject: Re: [Caml-list] about Obj.magic
> > One case can be 'almost-legal' : downcasting an object to its
> > class if you're sure that it has been previously upcasted to the
> > type class.
> >
> And here is how to break your code:
> class c = object method a : unit end
> let i = new_intf (new c)

In fact that sample can't be used if the class also use shadow types which
prevents the user from writing his own class and then making the program

Nicolas Cannasse

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