emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: map-char-table, optimize-char-table and `equal' comparisons


From: Stefan Monnier
Subject: Re: map-char-table, optimize-char-table and `equal' comparisons
Date: Fri, 16 May 2008 00:48:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]