Unifying filters and functions? [Was: Re: Show inverted filter result]
Benjamin Cama
benoar at dolka.fr
Thu Mar 22 14:57:20 CET 2012
Hi Ondrej,
Le jeudi 22 mars 2012 à 11:45 +0100, Ondrej Zajicek a écrit :
> One possible way is to write filters as functions (returning true or false)
> and then use 'where' to create filters: 'import where xxx()',
> 'show route where ! xxx()'.
This makes me think about why is there a difference between functions
and filters in the first place? Yes, functions accept argument, but
then? They return a value… a bit like filters return a decision. So,
what's really the big difference?
In my use of BIRD, I end up like you just suggested, transforming every
filter into functions and using “import where …”. This make me return
boolean values that are a bit less clear than accept/reject statements.
I am definitely not pleased by the choice I have to make between
fonction and filter.
I am wondering: is there a way to unify both? Do you think it's a good
idea? Do you have suggestions on how to do that? (i.e. we should do it
in a backward compatible fashion)
The way I see it, I would make filter into functions that return
booleans, and change 'accept' and 'reject' into “aliases” to 'return
true' and 'return false'. Concerning the message attached to them, I
don't really know… Make these keywords a bit more specials and make them
'print xxx; return true/false;'?
Thanks for any clue on this,
--
Benjamin
More information about the Bird-users
mailing list