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: Thu, 18 Oct 2012 08:33:59 -0400 Message-ID: References: <83ehkz4edw.fsf@gnu.org> <83bog33wdr.fsf@gnu.org> <837gqq49j7.fsf@gnu.org> <83r4ox3frd.fsf@gnu.org> <83ipa92i95.fsf@gnu.org> <83bog03jyf.fsf@gnu.org> <507F2C74.4070107@cs.ucla.edu> <83391c2xjq.fsf@gnu.org> <83wqyo1129.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1350563662 27772 80.91.229.3 (18 Oct 2012 12:34:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Oct 2012 12:34:22 +0000 (UTC) Cc: Juanma Barranquero , eggert@cs.ucla.edu, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 18 14:34:29 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 1TOpIx-0000k5-Ck for ged-emacs-devel@m.gmane.org; Thu, 18 Oct 2012 14:34:27 +0200 Original-Received: from localhost ([::1]:45808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOpIq-0000mq-9r for ged-emacs-devel@m.gmane.org; Thu, 18 Oct 2012 08:34:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOpIe-0000f5-F8 for emacs-devel@gnu.org; Thu, 18 Oct 2012 08:34:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOpId-0006dv-Fb for emacs-devel@gnu.org; Thu, 18 Oct 2012 08:34:08 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:59861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOpIX-0006co-Mp; Thu, 18 Oct 2012 08:34:01 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCoeh/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kLoduBboJkEQDozOBWIMFgTwa X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="202043788" 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; 18 Oct 2012 08:34:00 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 8FBA959525; Thu, 18 Oct 2012 08:33:59 -0400 (EDT) In-Reply-To: <83wqyo1129.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 18 Oct 2012 13:17:50 +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:154411 Archived-At: >> In that case, wouldn't it be better to have the integer be an index >> into a table, like Stefan suggested? > It's easy to do that (of course, at a price of some slightly more > complicated memory management), I don't understand why the memory management would care about which integer you use to represent file-watcher descriptors. > but I think Stefan still prefers the "new object" solution. I generally like stronger types, so you're probably right, but an "index into a table" doesn't necessarily sound so terribly bad, if you have such a table anyway (BTW, is this table usable by Lisp, e.g. can they get the list of current file-watchers?). >> It's faster to check that it is in range than compare it with an >> arbitrarily long list of known pointers. > That's not what the code does. It calls Fassoc_quit to find the > descriptor in the list of known live watches (which will still be > needed under the table suggestion), Isn't Fassoc_quit going to "compare it with an arbitrarily long list"? To me this "list of known live watches" sounds exactly like the "table" I mention above. > and then validates the pointer itself, just in case (which is also > independent of the table suggestion). What means "validate"? Stefan