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 XAA14531; Thu, 15 Jul 2004 23:13:07 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA14931 for ; Thu, 15 Jul 2004 23:13:06 +0200 (MET DST) Received: from woodstock.1969.ws (64-215-156-42.eosinc.net [64.215.156.42]) by concorde.inria.fr (8.12.10/8.12.10) with SMTP id i6FLD4SH019403 for ; Thu, 15 Jul 2004 23:13:05 +0200 Received: (qmail 4985 invoked from network); 15 Jul 2004 21:05:34 -0000 Received: from karl.1969.ws (HELO ?10.3.2.15?) (10.3.2.15) by woodstock.1969.ws with SMTP; 15 Jul 2004 21:05:34 -0000 Message-ID: <40F6F40A.6080708@1969.ws> Date: Thu, 15 Jul 2004 14:15:54 -0700 From: Karl Zilles Organization: 1969 Communications, Inc. User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Carr CC: caml-list@inria.fr Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions? References: <200407152049.i6FKnnSd004687@psi-phi.mit.edu> In-Reply-To: <200407152049.i6FKnnSd004687@psi-phi.mit.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40F6F360.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 printf:01 printf:01 ocaml:01 assertions:01 distinguish:01 distinguish:01 match:02 wrote:03 obj:03 types:03 exceptions:04 carr:05 cares:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Carr wrote: > [None represented internally as 0] > > >>What's the representation of Some(None) then? The Some() goes away, and >>the containing value is unboxed- it turns out to be the same as just None. >>There is no way to differentiate Some(Some(Some(Some(None)))) from None. > > > 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. 0 and None are different types. There is no need to distinguish them. > > Is there valid code (no Obj.magic) that cares that (Some None) and > (None) are both represented by the same bit pattern? (Some None) and (None) are both the same type: a' option option Valid code: match x with | Some a -> printf "Some!" | None -> printf "None!" (Some None) should print Some!, (None) should print None!, but since the bit patterns are now the same... ------------------- 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