
At 09:56 AM 3/31/2005, Rob Stewart wrote:
Compound functions are appropriate when you throw away information that you otherwise get in one or two OS calls, such that the query becomes atomic. However, you don't have to have separate functions for each combination. Instead, you could define a series of properties that can be queried -- most likely as an enumerated type with binary values -- that can be bitwise OR'ed to get the set of properties the caller wants you to query. If all such properties are set, then the function returns true.
Such an approach means many current functions might be implemented in terms of the omnibus function, and it means that library users can define domain-specific, useful queries into named functions of their choice. You don't have to supply everything that way, but you supply the means to do so.
That works well for or'ed queries, and is pretty good for more complex queries. It can be inefficient if multiple operating system calls are required to build up the full set of attributes, but maybe that could be contained by careful attribute selection. I'll give it some thought. Thanks for the suggestion, --Beman