Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] undocumented external ... = "%identity"
[ 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] undocumented external ... = "%identity"
From: Stefano Zacchiroli <zack@bononia.it>

> It seems to me that the "%identity" feature, as in
> 
>   external unsafe_cast : 'a obj -> 'b obj = "%identity"
> 
> is undocumented. Am I wrong? If not is there any particular reason for
> so? According to http://caml.inria.fr/archives/200208/msg00034.html is
> not meant to be used by the end user, but if it's better than Obj.magic
> and used by lablgtk I see no reason to not mention it in the
> "Interfacing C with Objective Caml" chapter of the OCaml documentation.
> Maybe with a huge disclaimer ...

It is equivalent to Obj.magic, which uses the same external.
The only interest is that you can choose to give it a type more
restrictive than Obj.magic, while still being an external.
This way %identity completely disappears during compilation.

I suppose that as Obj.magic is not documented, this is not documented
either. 

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