Sven Neumann wrote:Yes, the proposed API may expose too much implementation details in some views. For perfect API, one may want to use an iterator, instead of an integer index. Then APIs will become,Hi, Tony Yat-Tung Cheung <dragonman asiayeah com> writes: gconstpointer g_hash_table_get_key(GHashTable *hash_table, GHashTableIterator iterator); gconspointer g_hash_table_get_value(GHashTable *hash_table, GHashTableIterator iterator);It's certainly an improvement for g_hash_table_foreach() to stop traversal when the callback function returns TRUE. We should have this, except that it breaks the current API. Even with it, sometimes the user may also want to do more than just stopping the trasversal. He/she may also want to get the current node, return a special value from the current function...etc. I think the most convenient API is an iterator, either in a simple integer index or an iterator structure. Thanks. Tony Cheung |