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 XAA14459; Thu, 15 Jul 2004 23:19:58 +0200 (MET DST) 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 XAA15779 for ; Thu, 15 Jul 2004 23:19:57 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6FLJsEV017318 for ; Thu, 15 Jul 2004 23:19:55 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i6FLJli28409; Thu, 15 Jul 2004 16:19:49 -0500 (CDT) Date: Thu, 15 Jul 2004 16:26:58 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: John Carr cc: caml-list@inria.fr Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions? In-Reply-To: <200407152049.i6FKnnSd004687@psi-phi.mit.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 40F6F4FA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 unboxing:01 checker:01 checker:01 foo:01 wether:01 ocaml:01 assertions:01 distinguish:01 wrote:03 obj:03 variable:03 variable:03 argument:03 redirect:95 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 15 Jul 2004, John Carr wrote: > There is also no way to distinguish 0 from None in the current > system. OCaml relies on type information to determine the meaning > of a value. Yes, but in Some(0), the 0 is boxed (because of the Some)- so Some(0) is different from None. I trust the type checker to make sure I can't have 0 and None in the same variable, just like I trust the type checker to make sure I can't have 0 and false in the same variable. > > Is there valid code (no Obj.magic) that cares that (Some None) and > (None) are both represented by the same bit pattern? let foo = function | None -> 0 | Some(None) -> 1 | Some(Some(_)) -> 2 ;; Now, wether you would actually see code like that in the "real world" is a different argument. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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