On Sat, Jun 25, 2022 at 09:08:30PM -0400, Wietse Venema <wie...@porcupine.org> wrote:
> raf: > > If .= can reliably distinguish between being applied to > > a list or scalar parameter, maybe it could automatically > > include a leading space when adding to lists. > > Unfortunately, the main.cf parser does not know if a parameter value > is used as a list such as > > export_environment = TZ MAIL_CONFIG LANG > export_environment .= NAME=value > > with intended result: > > export_environment = TZ MAIL_CONFIG LANG NAME=value > > and when a parameter is not: > > syslogname = ${multi_instance_name?{$multi_instance_name}:{postfix}} > syslogname .= /$service_name > > with intended result: > > syslogname = ${multi_instance_name?{$multi_instance_name}:{postfix}}/blah > > Even if the main.cf parser wree made list aware, the value from one > parameter can be substuted into another parameter value, i.e. list > and non-list parameter values can be combined. It's better not to > try to make the main.cf parser smart about list and non-list contexts. > > Wietse I thought that might be the case. I also thought of a ,= alternative but as Viktor says, string append isn't useful enough, and you'd want there to be a good case for adding both operations. Also, is .= the best notation? Would += be better? I just ask because . and .= are Perl operators for string concatenation/appending (so it makes perfect sense to those who are lucky enough to know Perl), but + and += might be more natural for those who only know other programming languages. cheers, raf