> On 23 Nov 2020, at 10:00, [email protected] wrote:
> 
> That helped. Bug free now. Thank you :).

The macro interface was a really bad idea. The problem is that it does not make
explicit the crucial distinction between an lvalue and rvalue.

OTOH the C interface is the most perfect interface I have seen.
Once you understand it, it is always obvious what the functions
return and what they accept as arguments.

For example, attempting to add a key to a JudyLArray,
you get a result telling if the key was found or not, and,
you provide a pointer to a location into which the pointer
to the value is put, whether or not the original key existed.
So you can immediately store a new value or overwrite the old one, 
or, fetch the value already stored if the result was to find an
existing key and you want to modify it.

I didn’t bother looking at the code to write that explanation,
I haven’t written an Judy for some time. It’s just that, what
I described, is the only possible way it could work efficiently,
and, therefore, that is how it actually does work :-)

In other words, you can deduce the interface using logic,
without looking at the specs or the code.

The hallmark of quality: an empty Judy array is a NULL pointer.
Beautiful.

—
John Skaller
[email protected]







_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to