Re: [exim] direct boolean values in AND failing

Top Pagina
Delete this message
Reply to this message
Auteur: Philip Hazel
Datum:  
Aan: Magnus Holmgren
CC: exim-users, 167
Onderwerp: Re: [exim] direct boolean values in AND failing
On Wed, 1 Aug 2007, Magnus Holmgren wrote:

> I' had trouble seeing the benefit of adding "true" and "false" as trivial
> conditions, taking no arguments.


Note also that Exim expands left to right. You are asking for something
like {$something} to work as a condition if the expansion of $something
is a truth value. The code doesn't work like that. After Exim has read

${if and {{

it looks for one of the known condition names (eq, >, matches, etc) as a
*literal string*. After it has found something it recognizes, it then
knows how many arguments are required, and then it expands each of the
arguments *independently*. Consider

  ${if and {                                    \
           {eq{$something}{true}}               \
           {some other condition}               \
           }                                    \
           {yes string}{no string}}   


It won't expand $something until it has seen "eq", after which it knows
to expect two arguments.

If Exim did any kind of "pre-expansion" it would often be expanding
substrings that it then discarded.

One could implement the literal condition "true" (with zero arguments),
but it would be pretty useless, wouldn't it?

Another way of looking at what I am saying is that Exim doesn't expand
strings twice by default. ... Hmm, you can of course make it do so by
using the "expand" operator. So if you could say

${if true {x}{y}}

then you could also say

${expand: \${if ${lookup...} {yes}{no} }

and if the lookup returned "true" it would work. But is not, IMHO, a
great advance on what you can already do:

${lookup... {${if eq{$value}{true}{yes}{no}} {no} }



-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book