[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exceptions that pass continuations
From: |
Thien-Thi Nguyen |
Subject: |
Re: Exceptions that pass continuations |
Date: |
Fri, 19 Jul 2013 15:00:56 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
() Panicz Maciej Godek <address@hidden>
() 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?
--
Thien-Thi Nguyen
GPG key: 4C807502
(if you're human and you know it)
read my lisp: (responsep (questions 'technical)
(not (via 'mailing-list)))
=> nil
pgpxRA_5TSXx3.pgp
Description: PGP signature