Add isFilter
bit to kernel operation objects, and a IS_FILTER
kernel function
#1615
Labels
isFilter
bit to kernel operation objects, and a IS_FILTER
kernel function
#1615
The following rambling is taken from PR #1593:
Hmm, I am not sure I understand [the code for
IsFilter
inlib/filter.g
] (both old and new version).[ For reference, this is the code in question: ]
Perhaps we can walk through it? (And perhaps the comment above it could be expanded to explain it, too?)
So first we handle
IS_OBJECT
/IsObject
, which is special. OK. next we exclude everything that is not an operation, also fine.But now in the old code, we look at
FLAG1_FILTER( x )
, and it is non-zero, we considerx
a filter. Aha. But this is not quite right, as we have:So I guess that's why you changed this to also requite
FLAGS_FILTER(x) <> false
? How about instead or additional usingNARG_FUNC(x)=1
? I simply suggest that as it is immediately clear to me why that's a necessary condition for a filter, whileFLAGS_FILTER(x) <> false
isn't (simply because I have to look up what it does). But anyway, if usingFLAGS_FILTER
is "correct", that's also fine.So... that leaves the question: Why do we need the final
or x in FILTERS
? Aha:Aha! So testers for attributes fall through:
Hmm...
At this point I got a headache, and started to wonder: Why don't we add a bit "isFilter" to the header of an operation, and add an
IS_FILTER
function to the kernel, which just returns that bit?Note that we don't even need to grow the operation header for this, we could split
ENABLED_ATTR
into a bitfield. (I'd start by adding anOperationHeader
struct, as described previously)The text was updated successfully, but these errors were encountered: