Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 175C2431FAF for ; Mon, 23 Apr 2012 08:07:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TxsVU5sNw1PQ for ; Mon, 23 Apr 2012 08:07:26 -0700 (PDT) Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2C311431FAE for ; Mon, 23 Apr 2012 08:07:26 -0700 (PDT) Received: by eaa1 with SMTP id 1so4912810eaa.26 for ; Mon, 23 Apr 2012 08:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=WA3Wqp46pcCqFw/5HuNJJKjQIw5GOpMJ9NtnEc9d+ck=; b=S0RRDY0ZLyP6XOm/++aliPpMw/9ZhIgY5ppBjxgz97dwbJInbxjaLGCROPCmXHMHiq ChL8l+VLKMnqgIEuDbwNTfgTJ9sGac+pJ0RjWMdSlzqB4n4/QgZ1ZHalvdBk/0REFq/r LSjGOEUqKy/ruSTZQ3Ore2bGO8DJC09d5qe0wniw0NjHXW+FRUIWvnXx4cpIc8vfOn+U 5suq62KLrFwhWKDM6W3IJp4HbfzFZnQsfabJkQfAy816PnjynbIwJDbbgVnSxfq66Hlg 4OQGrjXrr21hbWtmvk1NVPcP92YbsvK4NNvhVzih+7r/kQg7E3DLIF9F6IsTTahWgLUu p2Dw== MIME-Version: 1.0 Received: by 10.213.16.140 with SMTP id o12mr1239676eba.150.1335193643295; Mon, 23 Apr 2012 08:07:23 -0700 (PDT) Received: by 10.213.103.18 with HTTP; Mon, 23 Apr 2012 08:07:23 -0700 (PDT) In-Reply-To: References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com> Date: Mon, 23 Apr 2012 18:07:23 +0300 Message-ID: Subject: Re: [PATCH] ruby: make sure the database is closed From: Felipe Contreras To: Ali Polatel Content-Type: text/plain; charset=UTF-8 Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Apr 2012 15:07:27 -0000 On Mon, Apr 23, 2012 at 5:04 PM, Ali Polatel 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