Concerns regarding some library functions

Subject: Concerns regarding some library functions

Date: Tue, 27 Sep 2011 16:25:58 +0300

To: notmuch@notmuchmail.org

Cc:

From: Ali Polatel


Hello,

Being the maintainer of Ruby bindings, I've been watching the
development of API changes closely. Ruby bindings are nearly complete
with the exception of two functions which I think are poorly implemented
in terms of error handling.

The two functions I've mentioned above are
notmuch_database_find_message() and
notmuch_database_find_message_by_filename().

The problem with their design is NULL return may both mean an error
condition and "message not found". However, we already have a similar
function which does not have such a flaw, namely notmuch_database_add_message().

In my humble opinion it is a good idea to modify these functions to
return 'notmuch_status_t' and add an argument 'notmuch_message_t **'
which will be initialized to the message object upon successful return.
This is just like notmuch_database_add_message() which provides both
consistency and proper error reporting.

I vaguely remember this question was raised on the list for
notmuch_database_find_message() before. Seeing the recent addition of
notmuch_database_find_message_by_filename(), I wanted to bring this up
again in the hope to get it fixed as soon as possible.

I am not providing a patch here considering the simplicity of the
problem but if anyone needs elaboration, I will be happy to submit a
patch.

P.S.: Ruby bindings don't have wrappers for these functions but I am not
sure about Python bindings and how they solve, or 'hack around', this
problem. CC'ing Sebastian for comments so we can have consistency
between bindings.

        -alip
part-000.sig (application/pgp-signature)

Thread: