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, 01 May 2011 23:14:56 +0200 Message-ID: References: <87fwqrqbzg.fsf@gnu.org> <87bp0wzo6l.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 1304284513 12393 80.91.229.12 (1 May 2011 21:15:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 1 May 2011 21:15:13 +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 May 01 23:15:08 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QGdyu-00059H-FI for guile-devel@m.gmane.org; Sun, 01 May 2011 23:15:08 +0200 Original-Received: from localhost ([::1]:54518 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGdyt-0005Kw-Ve for guile-devel@m.gmane.org; Sun, 01 May 2011 17:15:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGdyq-0005JW-PP for guile-devel@gnu.org; Sun, 01 May 2011 17:15:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGdyp-0007Qk-Ff for guile-devel@gnu.org; Sun, 01 May 2011 17:15:04 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:45367 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGdyp-0007Qf-C7; Sun, 01 May 2011 17:15:03 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 938D55A47; Sun, 1 May 2011 17:17: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=AfU0nZDEAmkU VipNa5S9POY9sWM=; b=YJ90yVIeFwSlXtT7Dy1OAsJV5bMGW15QvJ9zpkD/3WrR kGVpQMYfrIgpqq8d8DWQF1G2uOcrHvFv8QG2pb3reUOCsI9lcLiA+i7m6ZQq4OM6 +47d7SBvL+aFRJvNiyrMWAcB5mBzlXJdZsgU2UNA5wFWQjz34FY6ZZkgYC3PYWo= 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=GHxSjZ fSKrIQqErrJWSchG9zdCm5oUWpuiAekOTXi9h9KhZUClrgBgjJLbN6BQO49fM6J9 yXn73rVf7ZZWNvxuFt7t2lzJLxwzSh5Ec//rYTZNNrmweF5oJzbbBqlmr60iAcf5 53qYLg68bIMohMAIExAqoFvFRxSgz9X4aXeJU= 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 7F6F85A46; Sun, 1 May 2011 17:17: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 A1A8D5A43; Sun, 1 May 2011 17:17:02 -0400 (EDT) In-Reply-To: <87bp0wzo6l.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 27 Mar 2011 15:29:54 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 5CC32DD8-7438-11E0-98C9-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.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12396 Archived-At: Hi :) On Sun 27 Mar 2011 15:29, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Andy Wingo writes: > >> 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. > > Yes, sounds good. Would you like to work on it? :-) I have done this now. There were a few places within Guile that were using the get-handle / create-handle! API with weak hash tables, which I fixed. It's quite possible that user code also does this, but between random failures to `(car x)' and preventative errors, I chose the latter. We can back it down to a warning if that's the right thing to do, though. Andy --=20 http://wingolog.org/