|
From: | Paolo Bonzini |
Subject: | Re: RFC: modules for generic unordered sets and mappings |
Date: | Fri, 02 Jul 2010 12:55:42 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5 |
On 07/02/2010 01:37 AM, Bruno Haible wrote:
Hi all, Apropos hash tables. For some years now, we have generic lists in gnulib. "Generic" means that the programmer can switch the implementation easily, because he's programming against an abstract API that has a number of different implementations. Here is my draft for applying the same approach to unordered sets. The normal implementation would be a hash table, but there are important variations: - Is the key a pointer, or a memory block of arbitrary size? - Is the value stored, or implicit? - Does inserting a (key,value) pair make a copy of the key? - Does the table allow removals? Feedback is highly appreciated! Do you see some interesting use case that I have overlooked?
I disagree that all these should be in gnulib. In fact, I think ADTs don't belong there. libunistring and crypto stuff are borderline already (because some of the modules actually make sense in gnulib, e.g. uniwidth and sha1), but these should be in a shared library, not a static one.
In fact, glib or libnih probably provide all that you need already, and they're always loaded on a modern Linux system so their cost is effectively zero. (Then, getting stuff into glib is a royal pain in the ass).
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |