From: Thien-Thi Nguyen <ttn@gnu.org>
To: Panicz Maciej Godek <godek.maciek@gmail.com>
Cc: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: Re: Exceptions that pass continuations
Date: Fri, 19 Jul 2013 15:00:56 +0200 [thread overview]
Message-ID: <8738ra3drr.fsf@zigzag.favinet> (raw)
In-Reply-To: <CAMFYt2Z+_iPSLQnXXa1Nvw9T79DiYsWZxzLf7WPoE-41ZtGyFA@mail.gmail.com> (Panicz Maciej Godek's message of "Fri, 19 Jul 2013 12:39:55 +0200")
[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]
() Panicz Maciej Godek <godek.maciek@gmail.com>
() 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
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2013-07-19 13:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-19 10:39 Exceptions that pass continuations Panicz Maciej Godek
2013-07-19 13:00 ` Thien-Thi Nguyen [this message]
2013-07-19 13:52 ` Panicz Maciej Godek
2013-07-19 16:14 ` Thien-Thi Nguyen
2013-07-19 14:12 ` Taylan Ulrich B.
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8738ra3drr.fsf@zigzag.favinet \
--to=ttn@gnu.org \
--cc=godek.maciek@gmail.com \
--cc=guile-user@gnu.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).