From: Damien Doligez <damien.doligez@inria.fr>
To: caml-list@inria.fr, caml-bugs@pauillac.inria.fr
Subject: [Caml-list] Re: Constants immediatelly disappear from the Weak array. (PR#1925)
Date: Wed, 12 Nov 2003 13:49:05 +0100 [thread overview]
Message-ID: <9969407E-150E-11D8-AD29-00039310CAE8@inria.fr> (raw)
In-Reply-To: <200311120908.KAA10511@pauillac.inria.fr>
On Wednesday, November 12, 2003, at 10:13 AM, Aleksey Nogin wrote:
> When trying to switch from 3.06 to 3.07+2 I've noticed the following
> difference in how the Weak module works:
[
In 3.06, an empty list [] does not disappear from a weak array;
in 3.07+2 it disappears immediately
]
> Basically, in 3.07+2, the empty list disappears from the weak array as
> soon as it is added into it. Is this a bug or a feature?
Feature.
> The old behavior is useful because it allows to assume that while a
> value is referenced somewhere, Weak.get will always return Some. This
> allowed using Weak.get as an indicator of whether it was OK to discard
> some "helper" data (which should be only discarded after the primary
> data is no longer in use).
Yes, but. In 3.06, [] will never be removed from the weak array, and
you will keep your helper data forever.
The source your the problem is that [] is not allocated in the heap.
It is represented by an integer value. Hence, there is no sharing
between various occurrences of [] in your data and the notion of a
weak pointer to [] does not make sense.
If you really want to make sure that you are manipulating pointers,
you should use a record or a list ref.
-- 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
next parent reply other threads:[~2003-11-12 12:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200311120908.KAA10511@pauillac.inria.fr>
2003-11-12 12:49 ` Damien Doligez [this message]
2003-11-12 23:22 ` Aleksey Nogin
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=9969407E-150E-11D8-AD29-00039310CAE8@inria.fr \
--to=damien.doligez@inria.fr \
--cc=caml-bugs@pauillac.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