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: map-char-table, optimize-char-table and `equal' comparisons Date: Fri, 16 May 2008 00:48:21 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210913332 14118 80.91.229.12 (16 May 2008 04:48:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 May 2008 04:48:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 16 06:49:27 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jwrsk-0000Xk-Je for ged-emacs-devel@m.gmane.org; Fri, 16 May 2008 06:49:26 +0200 Original-Received: from localhost ([127.0.0.1]:45317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jwrs1-0000KZ-Ab for ged-emacs-devel@m.gmane.org; Fri, 16 May 2008 00:48:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jwrrw-0000KO-P7 for emacs-devel@gnu.org; Fri, 16 May 2008 00:48:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jwrrv-0000Ja-4Q for emacs-devel@gnu.org; Fri, 16 May 2008 00:48:36 -0400 Original-Received: from [199.232.76.173] (port=50168 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jwrrv-0000JU-0v for emacs-devel@gnu.org; Fri, 16 May 2008 00:48:35 -0400 Original-Received: from 206-248-170-48.dsl.teksavvy.com ([206.248.170.48]:35933 helo=ceviche.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jwrrt-0003yT-JE for emacs-devel@gnu.org; Fri, 16 May 2008 00:48:34 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id DDFABB53DB; Fri, 16 May 2008 00:48:21 -0400 (EDT) In-Reply-To: (Kenichi Handa's message of "Wed, 14 May 2008 16:59:04 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Greylist: delayed 8948 seconds by postgrey-1.27 at monty-python; Fri, 16 May 2008 00:48:33 EDT X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:97237 >> Both map-char-table and optimize-char-table compare consecutive values >> using `equal' to determine whether to merge them into ranges. >> I can see that it may sometimes be useful, but it is dangerous since it >> may lose object identity information (obviously) and more importantly >> because `equal' can fail when comparing cyclic objects. >> I happened to be manipulating char-tables that map chars to other >> char-tables, sometimes in cyclic ways and that makes it impossible to >> use map-char-table ;-( >> Any objection to changing the internal comparison predicate to `eq'? > I remember that I intentionally made the comparison > predicate `equal' so that optimize-char-table can reduce the > number of elements for some kind of char-table. > How about adding the new property/attribute :test to > char-table (like make-hash-table) and make the default to > `equal'? That's an option, but maybe a better one is to just add a `test' argument to optimize-char-table (and then optimize-char-table could use that argument to replace `equal' elements with `eq' ones, so that subsequent `map-char-table' calls end up behaving as if a `test' function was provided even tho it's actually using just `eq'). Do you remember which call(s) to optimize-char-table needed the use of `equal'? Stefan