Author: Jeremy Harris Date: To: exim-users Subject: Re: [exim] Express list in reduce?
On 05/04/2021 18:51, Felipe Gasper via Exim-users wrote: >> On Apr 5, 2021, at 11:44 AM, Jeremy Harris via Exim-users <exim-users@???> wrote:
>>
>> On 05/04/2021 16:34, Felipe Gasper via Exim-users wrote:
>>> domainlist manualmx_domains = ${if exists {/etc/manualmx} {lsearch;/etc/manualmx} {} }
>>
>> That's not a valid definition for a named list.
>>
>> I suspect you've misread "lists are (string-) expanded before use" as meaning
>> that list *definitions* can have string-expansions. Not so. The string-expansion
>> is done on the text that should be a list, when some text is arrived at in the
>> context of a list being needed.
>
> Hrm. It … works for us? Is this something that happens to work but is undocumented?
Indeed, hrm. Turns out I was wrong, having been speaking without
actually reading through the code to check.
Most uses of lists get a string-expansion first, handled by the
routine that does a search in a list. But the "listnamed" operator
is doing something different, expanding a possibly-nested list, and
uses different code which does neither a string-expansion step
nor any lookup-equivalent expansions.
The string-expansion step could be regarded as a bug, because two uses
of a list object behave differently (anyone volunteering for doing the devel work?)
- but it seem infeasible to do a generic expansion for all possible
types of lookup which could be embedded as list elements.
So no, there's no way to re-cast the keys content of an lsearch file
as a comma-sep list. Perhaps you could write some custom perl
and use the ${perl} expansion.