From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA03766; Fri, 31 Oct 2003 08:50:31 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA03761 for ; Fri, 31 Oct 2003 08:50:20 +0100 (MET) Received: from nexus.stwing.upenn.edu (NEXUS.STWING.UPENN.EDU [165.123.132.61]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h9V7np118948 for ; Fri, 31 Oct 2003 08:49:51 +0100 (MET) Received: from force.stwing.upenn.edu (root@force.stwing.upenn.edu [165.123.132.65]) by nexus.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id h9V7lnGr027146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 31 Oct 2003 02:47:50 -0500 (EST) Received: from force.stwing.upenn.edu (wlovas@localhost [127.0.0.1]) by force.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id h9V7lmGQ029530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 31 Oct 2003 02:47:49 -0500 (EST) Received: (from wlovas@localhost) by force.stwing.upenn.edu (8.12.10/8.12.9/Submit) id h9V7lmXe029529 for caml-list@inria.fr; Fri, 31 Oct 2003 02:47:48 -0500 (EST) Date: Fri, 31 Oct 2003 02:47:48 -0500 From: William Lovas To: caml-list@inria.fr Subject: Re: [Caml-list] undocumented external ... = "%identity" Message-ID: <20031031074747.GA29233@force.stwing.upenn.edu> Mail-Followup-To: caml-list@inria.fr References: <20031029104248.GA6566@fistandantilus.takhisis.org> <20031029203935I.garrigue@kurims.kyoto-u.ac.jp> <20031030195548.GD19967@fistandantilus.takhisis.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031030195548.GD19967@fistandantilus.takhisis.org> User-Agent: Mutt/1.5.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; lovas:01 wlovas:01 stwing:01 caml-list:01 undocumented:01 0900,:01 jacques:01 restate:01 undocumented:01 module's:01 runtime:01 interfacing:01 apis:01 awry:01 monniaux:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Oct 30, 2003 at 08:55:48PM +0100, Stefano Zacchiroli wrote: > On Wed, Oct 29, 2003 at 08:39:35PM +0900, Jacques Garrigue wrote: > > I suppose that as Obj.magic is not documented, this is not documented > > either. > > Ok, thanks for your answer. > > Now, let me restate my question: whi obj.magic _and_ "%identity" are not > documented? Usually undocumented stuff is stuff subject to changes, not > 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. > Practically, a lot of people use Obj.magic when needed and it seems to > be part of the required knowledge to be a "discriminating hacker"(TM). > The reason that it's unsafe and can make your program crash, IMO, is not > a good reason not to have it documented. Indeed C interfacing APIs are > 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