bug-guile-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-guile-ncurses] effects in gc handlers


From: rain1
Subject: [Bug-guile-ncurses] effects in gc handlers
Date: Sat, 30 Apr 2016 23:24:25 +0100
User-agent: Roundcube Webmail/1.0.6

Hello!

Somebody was having trouble with gc semantics in ncurses. They were asking about how to ensure X would not be garbage collected before Y. I believe that should never be an issue when writing scheme code.

I had a search through the docs for 'garbage':

If that #<window> is garbage collected, the curses library cannot continue.

Procedure: delwin win
   This function is called implicitly if a window is garbage collected.

So effects are being triggered by garbage collection. I suppose that this is done to try to make the library easier to use but in fact it cause an abstraction leak where programmers had to worry about GC semantics.

An alternative solution could be to define and use a form like (with-win (lambda (w) ...)) to abstract over the create, use, delete pattern that is standard in C.

I've created a patch here that removes effects from garbage collection handlers: https://github.com/rain-1/guile-ncurses-nogceffects/commit/e6cbeb6b296e5a10cf5ec34dbd18c37670bcc2db

I hope that it or at least the idea is useful to someone!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]