From: Damien Doligez <damien.doligez@inria.fr>
To: caml Caml <caml-list@inria.fr>
Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions?
Date: Mon, 19 Jul 2004 10:58:34 +0200 [thread overview]
Message-ID: <D0D701EB-D961-11D8-A7B0-00039310CAE8@inria.fr> (raw)
In-Reply-To: <20040716164020.GA6263@yquem.inria.fr>
On Jul 16, 2004, at 18:40, Xavier Leroy wrote:
>>> The idea is just to reserve a sufficiently large memory area to
>>> represent every needed (Some (Some ...(Some None) ...)).
>>
>> 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.
Unless I am badly mistaken, the compactor already has to deal with
such values (as out-of-heap pointers) and has no problem with them.
However, this is almost the same as Jacques' description, because
you still have to make sure that these special values point to some
area of memory where nothing will ever be allocated.
Finally, Jacques was not quite right in asserting that most options
are short-lived. This is only true if you don't use "option" in your
main long-lived data structure. Most seasoned OCaml programmers know
it, and sometimes it leads to rather contorted data structures.
> 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.
It is still bothering me, at least.
-- Damien
-------------------
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
prev parent reply other threads:[~2004-07-19 8:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-15 8:03 [Caml-list] " Radu Grigore
2004-07-15 10:18 ` Richard Jones
2004-07-15 10:28 ` Daniel Andor
2004-07-15 12:49 ` Radu Grigore
2004-07-15 13:33 ` Richard Jones
2004-07-15 13:58 ` Radu Grigore
2004-07-16 18:53 ` Aleksey Nogin
2004-07-17 2:55 ` John Prevost
2004-07-17 14:24 ` David MENTRE
2004-07-15 12:35 ` Jon Harrop
2004-07-15 13:45 ` Radu Grigore
2004-07-15 14:33 ` Jon Harrop
2004-07-15 15:05 ` Radu Grigore
2004-07-15 16:24 ` skaller
2004-07-15 15:38 ` [Caml-list] Unboxing options, was " Brian Hurt
2004-07-15 16:25 ` John Hughes
2004-07-15 17:00 ` Brian Hurt
2004-07-15 17:20 ` John Prevost
2004-07-15 19:14 ` Radu Grigore
2004-07-15 19:56 ` John Carr
2004-07-15 20:48 ` Brian Hurt
2004-07-15 20:49 ` John Carr
2004-07-15 21:15 ` John Prevost
2004-07-15 21:15 ` Karl Zilles
2004-07-15 21:26 ` Brian Hurt
2004-07-15 21:04 ` John Prevost
2004-07-15 21:17 ` skaller
2004-07-15 21:35 ` Brian Hurt
2004-07-15 21:51 ` skaller
2004-07-15 21:42 ` skaller
2004-07-16 0:35 ` Jacques GARRIGUE
2004-07-16 1:03 ` John Prevost
2004-07-16 2:00 ` Jacques GARRIGUE
2004-07-16 16:40 ` Xavier Leroy
2004-07-19 8:58 ` Damien Doligez [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D0D701EB-D961-11D8-A7B0-00039310CAE8@inria.fr \
--to=damien.doligez@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox