From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user Subject: Re: Exceptions that pass continuations Date: Fri, 19 Jul 2013 15:00:56 +0200 Message-ID: <8738ra3drr.fsf@zigzag.favinet> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1374238710 13107 80.91.229.3 (19 Jul 2013 12:58:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Jul 2013 12:58:30 +0000 (UTC) Cc: "guile-user@gnu.org" To: Panicz Maciej Godek Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jul 19 14:58:30 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V0AGU-0005SV-2S for guile-user@m.gmane.org; Fri, 19 Jul 2013 14:58:30 +0200 Original-Received: from localhost ([::1]:51573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0AGT-0005ze-Q1 for guile-user@m.gmane.org; Fri, 19 Jul 2013 08:58:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0AGK-0005yd-Lr for guile-user@gnu.org; Fri, 19 Jul 2013 08:58:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0AGJ-0000Kz-E2 for guile-user@gnu.org; Fri, 19 Jul 2013 08:58:20 -0400 Original-Received: from smtp209.alice.it ([82.57.200.105]:43156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0AGJ-0000Ks-2q for guile-user@gnu.org; Fri, 19 Jul 2013 08:58:19 -0400 Original-Received: from zigzag.favinet (79.10.68.118) by smtp209.alice.it (8.6.060.26) id 51DBE1A701A0D022; Fri, 19 Jul 2013 14:58:16 +0200 Original-Received: from ttn by zigzag.favinet with local (Exim 4.72) (envelope-from ) id 1V0AIz-0000WG-L7; Fri, 19 Jul 2013 15:01:05 +0200 In-Reply-To: (Panicz Maciej Godek's message of "Fri, 19 Jul 2013 12:39:55 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.105 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10556 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable () Panicz Maciej Godek () Fri, 19 Jul 2013 12:39:55 +0200 and the whole thing can be used as follows (let ((resources '())) (supply (((release-resource r) (set! r (cons r resources)))) (let ((r (allocate-resource))) (demand 'release-resource r) (do-something-constructive-with r))) (for-each release-resource resources)) (of course, this makes little sense if the resource is released within the same procedure it is allocated, but if the release cannot be performed locally, it seems the right thing) I wonder whether this design pattern has ever been used before, or if there are any potential flaws with its application. Maybe i'm missing something about this particular situation, but i think generally, the open-use-close pattern in the presence of gc is best handled by SMOBS and guardians. The resource is "opened" on SMOB construction, used for some time and then either explicitly "closed" (and forgotten) or forgotten. The guardian notes the state (still open, already closed) of its objects and closes the ones that need it. In this case, are OpenGL "lights" not amenable to wrapping as a SMOB? =2D-=20 Thien-Thi Nguyen GPG key: 4C807502 (if you're human and you know it) read my lisp: (responsep (questions 'technical) (not (via 'mailing-list))) =3D> nil --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAlHpOIsACgkQZwMiJEyAdQI6lQCgwkaVbVHq0B0BafjtSdQHrQvJ cLkAoIFOHZE99ZfPRLnnQksm+CkDYFMR =QQmR -----END PGP SIGNATURE----- --=-=-=--