From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Lisp object that refers to a C struct Date: Wed, 17 Oct 2012 16:27:39 -0400 Message-ID: References: <83ehkz4edw.fsf@gnu.org> <83bog33wdr.fsf@gnu.org> <837gqq49j7.fsf@gnu.org> <83k3up2iem.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1350505666 913 80.91.229.3 (17 Oct 2012 20:27:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Oct 2012 20:27:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 17 22:27:53 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TOaDY-000241-3Q for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2012 22:27:52 +0200 Original-Received: from localhost ([::1]:46805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOaDR-0007y0-21 for ged-emacs-devel@m.gmane.org; Wed, 17 Oct 2012 16:27:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOaDP-0007xi-Hp for emacs-devel@gnu.org; Wed, 17 Oct 2012 16:27:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOaDO-0007tm-QO for emacs-devel@gnu.org; Wed, 17 Oct 2012 16:27:43 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:58366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOaDN-0007ry-Ey; Wed, 17 Oct 2012 16:27:41 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCoeh/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="201918694" Original-Received: from 76-10-135-161.dsl.teksavvy.com (HELO pastel.home) ([76.10.135.161]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 17 Oct 2012 16:27:40 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 6149E59523; Wed, 17 Oct 2012 16:27:39 -0400 (EDT) In-Reply-To: <83k3up2iem.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 Oct 2012 18:05:37 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154389 Archived-At: >> The code to free the C struct will be the one you write >> specifically for it, nobody else knows how to free it. > Then the code that GC's this new Lisp object will have to be entirely > specific to the layout of the struct I'm using, right? I said "free" not "GC's". The GC decide what to free, and takes care of freeing most of the objects in the heap. The code that frees the Lisp_Misc file-watcher will be the generic GC code. And that generic code will have to trigger your specific code that frees the C struct. > It won't be suitable even for the similar-but-different inotify code, > right? Depends, you can make it generic by having the Lisp_Misc object have 2 slots: one containing the pointer to the C struct and another pointing to the matching freeing function. Stefan