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

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

Jacques Garrigue

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