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 SAA28463; Fri, 16 Jul 2004 18:40:23 +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 SAA27937 for ; Fri, 16 Jul 2004 18:40:22 +0200 (MET DST) Received: from yquem.inria.fr (yquem.inria.fr [128.93.8.37]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6GGeKEV011004; Fri, 16 Jul 2004 18:40:21 +0200 Received: by yquem.inria.fr (Postfix, from userid 18180) id C7BE8BC78; Fri, 16 Jul 2004 18:40:20 +0200 (CEST) Date: Fri, 16 Jul 2004 18:40:20 +0200 From: Xavier Leroy To: John Prevost Cc: caml-list@inria.fr Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions? Message-ID: <20040716164020.GA6263@yquem.inria.fr> References: <20040716.093517.95470327.garrigue@kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Miltered: at nez-perce with ID 40F804F4.001 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 caml's:01 pointers:01 -byte:01 aligned:01 compactor:01 jacques:01 sighted:01 caml:01 assertions:01 coq:02 heap:03 types:03 types:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > The idea is just to reserve a sufficiently large memory area to > > represent every needed (Some (Some ...(Some None) ...)). > > Apologies for keeping the conversation going, but since I just > thought of this: > Caml's internal pointers are at minimum 4-byte aligned. What about > using the other "safe" set of trailing bits, "10", to mark options? > i.e.: > None = ...0010 (2) > Some None = ...0110 (6) This is very tempting indeed, but the Caml heap compactor already uses the ...10 encoding to temporarily mark some data during compaction. As Jacques said, we've toyed with the idea of encoding option types specially for quite a while, and even prototyped it at some point, but never got convinced that it was really important to do so. Someone asked whether "option option" types occur in "real life". One occurrence was sighted in the sources of an old version of Coq. I haven't checked if it is still there. - Xavier Leroy ------------------- 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