Re: Decision Tables



"Bartc" <bc@xxxxxxxxxx> writes:

"Ben Bacarisse" <ben.usenet@xxxxxxxxx> wrote in message
news:87abmo9n9b.fsf@xxxxxxxxxxxx
<snip>
What you a showing, I think, is a language that can index record
(or structure) members. In the posted C++, this is done by using
pointers to member functions. Both are key to one part of the OP's
problem but neither really gets to the heart of the OP's question --
how to represent (or denote) compound match predicates.

You mean how to specify which fields are to be compared and to what?

Yes -- the tests (not the results!) computed from run-time data. The
key point (and this was not explicit so I may have missed the real
intent) was that the functions were indexed in a table so that
run-time data could be used to say what gets matched. The classic
general example would be a network packet filter -- command line
arguments specify what constitutes a match (e.g. one can type "match
src.addr = 129.168.1.1 & dst.port > 1024").

The posted example just listed all the combinations of exact
comparisons between all possible fields represented as bits in a
mask. I took Malcolm's suggestion that the solution was rather
under-engineered to suggest a more general solution where a general
predicate could be stored in the program. The obvious method being to
use first-class function values if the language supports them.

--
Ben.
.