From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: =?utf-8?b?4oCYc2V0LWNkciHigJk=?= and weak-cdr pairs Date: Sun, 27 Mar 2011 13:22:57 +0200 Message-ID: References: <87fwqrqbzg.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1301229274 16589 80.91.229.12 (27 Mar 2011 12:34:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 Mar 2011 12:34:34 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Mar 27 14:34:30 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q3pAr-0003yy-3c for guile-devel@m.gmane.org; Sun, 27 Mar 2011 14:34:29 +0200 Original-Received: from localhost ([127.0.0.1]:36308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q3pAq-0007kD-HH for guile-devel@m.gmane.org; Sun, 27 Mar 2011 08:34:28 -0400 Original-Received: from [140.186.70.92] (port=50717 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q3pAk-0007in-P0 for guile-devel@gnu.org; Sun, 27 Mar 2011 08:34:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q3pAj-0005Jh-L2 for guile-devel@gnu.org; Sun, 27 Mar 2011 08:34:22 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:43983 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q3pAj-0005JX-Iu; Sun, 27 Mar 2011 08:34:21 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id EAFED46F7; Sun, 27 Mar 2011 08:36:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=BvYGw8q+Mlc+ BGhGbrsoq47RxCw=; b=X9cWgLixHiAfoy2mbUif+Mf1kq0eiA/8mW4026pLd++d 3TTh8lOoJZdZtnfH5bmzhtxVAqcWGz5mREExopX3Mlz6PD6kwWmu4xGeX/BnC7yu 5k1TWwf5Kmg7Mxcm1Atfyt8bf7tPmu+KHzVoFLvelTn3lClMgNiHU48xd2ncgkM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=UfF9Qs Ag/PiJG/mComCVEN1Lyb5XciP/IerQPBfCFe8bmmEpHVkCxZml0+BHnIltjkJxCU g4Ds71PlsFicAsRq4Xz/TDasgdAj2BtiNI/cNpjs1mxIFE7U1xya0BZJbPqEMzZ7 XfNjXDZ2BSPLS8zyZXW+ruFEs84kOZdW37/r0= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id D83BA46F6; Sun, 27 Mar 2011 08:36:04 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 3650846F4; Sun, 27 Mar 2011 08:36:02 -0400 (EDT) In-Reply-To: <87fwqrqbzg.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 13 Mar 2011 16:25:07 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: C81B7706-586E-11E0-95B6-E8AB60295C12-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12004 Archived-At: On Sun 13 Mar 2011 16:25, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > The problem is that =E2=80=98hash-create-handle!=E2=80=99 above created a= weak-cdr > pair=E2=80=94i.e., a pair whose cdr is /not/ scanned for pointers=E2=80= =94but =E2=80=98set-cdr!=E2=80=99 > did not register a disappearing link from O to K+V. Consequently, O > eventually gets collected, but K+V remains; the storage of O then gets > reused, and the cdr of K+V ends up containing either an unrelated or >an > invalid Scheme object. Given that we don't expose weak-pair constructors or accessors to Scheme, we should not expose weak pairs to Scheme. What do you think about making it an error to hash-create-handle! on a weak table? That way you never expose a weak pair to Scheme. It does appear possible to discriminate in C between calls to create-handle! that occur due to ref / set! and those that are called explicitly. Also that would free up our implementation to use something other than weak pairs for weak hash tables. In particular, I think first-class weak references are not a bad idea, as Chez Scheme does. WDYT? Andy --=20 http://wingolog.org/