<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/10/6f143a8ee65352584200d7f3b19c3dd7"
  from="William Lovas &lt;wlovas@s...&gt;"
  author="William Lovas"
  date="2003-10-31T07:50:31"
  subject="Re: [Caml-list] undocumented external ... = &quot;%identity&quot;"
  prev="2003/10/6a6b72183aecc41c4e1860237ead3072"
  next="2003/10/83d907aa36714be69cdf730269e4a127"
  prev-in-thread="2003/10/53ed181ea2d15c4df636927cc0a1c6e1"
  next-in-thread="2003/11/040e05d79a919ba9c86528abb83627d1"
  prev-thread="2003/10/ed044d47f888bfffb6ffeacf6d6db1b0"
  next-thread="2003/10/7efb2636e8baabcc0cb88a95c395b229"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] undocumented external ... = &quot;%identity&quot;">
<msg 
  url="2003/10/c1d88aa9ad04cea7789936b975e4db80"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-10-29T10:42:51"
  subject="[Caml-list] undocumented external ... = &quot;%identity&quot;">
<msg 
  url="2003/10/978e0f49fa4d6d930a84eda296ee6e7c"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-10-29T11:39:46"
  subject="Re: [Caml-list] undocumented external ... = &quot;%identity&quot;">
<msg 
  url="2003/10/53ed181ea2d15c4df636927cc0a1c6e1"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-10-30T19:55:51"
  subject="Re: [Caml-list] undocumented external ... = &quot;%identity&quot;">
<msg 
  url="2003/10/6f143a8ee65352584200d7f3b19c3dd7"
  from="William Lovas &lt;wlovas@s...&gt;"
  author="William Lovas"
  date="2003-10-31T07:50:31"
  subject="Re: [Caml-list] undocumented external ... = &quot;%identity&quot;">
<msg 
  url="2003/11/040e05d79a919ba9c86528abb83627d1"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-11-01T08:22:20"
  subject="Re: [Caml-list] undocumented external ... = &quot;%identity&quot;">
<msg 
  url="2003/11/78e8cd539dbccb9187e2f80b19967a67"
  from="Damien Doligez &lt;damien.doligez@i...&gt;"
  author="Damien Doligez"
  date="2003-11-03T14:02:15"
  subject="Re: [Caml-list] undocumented external ... = &quot;%identity&quot;">
<msg 
  url="2003/11/1f8bcb5f83d24c8fcaaeb80de79389aa"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-11-03T14:20:12"
  subject="Re: [Caml-list] undocumented external ... = &quot;%identity&quot;">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Thu, Oct 30, 2003 at 08:55:48PM +0100, Stefano Zacchiroli wrote:
&gt; On Wed, Oct 29, 2003 at 08:39:35PM +0900, Jacques Garrigue wrote:
&gt; &gt; I suppose that as Obj.magic is not documented, this is not documented
&gt; &gt; either. 
&gt; 
&gt; Ok, thanks for your answer.
&gt; 
&gt; Now, let me restate my question: whi obj.magic _and_ "%identity" are not
&gt; documented? Usually undocumented stuff is stuff subject to changes, not
&gt; stable, ecc ...

Obj.magic's "behavior" *is* subject to change, since it depends upon the
underlying representation of values.  The Obj module's documentation is,
in a very real sense, the entire implementation of the O'Caml compiler and
runtime.

&gt; Practically, a lot of people use Obj.magic when needed and it seems to
&gt; be part of the required knowledge to be a "discriminating hacker"(TM).
&gt; The reason that it's unsafe and can make your program crash, IMO, is not
&gt; a good reason not to have it documented. Indeed C interfacing APIs are
&gt; documented and they are as risky as using Obj.magic and friends.

It's a little more than just unsafe -- when you use the Obj module, your
program becomes dependent upon the implementation of O'Caml.

Also, while it's true that interacting with C code is just as unsafe as
using the Obj module, interacting with C code is also a lot *harder* than
using the Obj module.  Presumably, if one understands how to interface
O'Caml with C, they're aware of the risks and will exercise sufficient
care.  Even a seasoned hacker's careless use of Obj.magic can go awry, as
seen in the recent thread about IEEE floating point equality.

To be fair, David Monniaux posted a message once explaining when Obj.magic
is "okay" to use:

    http://pauillac.inria.fr/caml/caml-list/0975.html

Such "okay" uses are sufficiently bizarre, though, that it makes sense to
leave the Obj module undocumented -- anyone who needs it will already
understand how it works.

cheers,
William

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

</contents>

</message>

