Re: [PATCH] ruby: make sure the database is closed

Subject: Re: [PATCH] ruby: make sure the database is closed

Date: Mon, 23 Apr 2012 18:07:23 +0300

To: Ali Polatel

Cc: notmuch@notmuchmail.org

From: Felipe Contreras


On Mon, Apr 23, 2012 at 5:04 PM, Ali Polatel <alip@exherbo.org> wrote:

> I'd rather not do this.
> Please read: http://comments.gmane.org/gmane.comp.lang.ruby.general/320324

OK, I've read this.. So?

The order in which Ruby's garbage-collector frees the database and
other objects is irrelevant, because with this patch we are not
manually freeing other objects, only the database.

Sure, it's _better_ if the user calls close(), even better if it's
inside an 'ensure', and even better if blocks are used (which I am
using in most cases), but that's not *required*.

The user might just do:

def foo
  db = Notmuch::Database.new($db_name, :mode => Notmuch::MODE_READ_WRITE)
end

That's perfectly fine in Ruby (although not ideal), since 'db' will
get garbage-collected. But nobody will be able to use the database
again until that process is killed.

You think that's correct?

-- 
Felipe Contreras

Thread: