Hi Marcus,

In general I think conditional INI support can benefit many of our
users. We just need to make sure that we cover the most common needs and
also that we keep it very basic and simple so that we don't boil the
ocean and maintain two languages. So it's a balance we need to meet.

It would be very helpful that as part of the feedback loop you write
something a bit more detailed about this feature and what is and isn't
supported. I imagine most people on this list would have a hard time to
figure that out from the patch. This includes:
- What operators are supported in conditionals
- Are there any "functions" like empty() or is the ternary operator the
proposed solution for that?
- Is it possible to get to environment variables from this? If so how is
it namespaced? How about registry on Windows?
- What happens when you use a variable which is not set?
- Do you propose a solution for concatenation of two values or is this
outside the scope?
- Can each [IF] include multiple conditionals i.e. $(value) > 1 AND
$(value) < 5 or just one condition with the expectation that people will
use nesting.

A few specific feedbacks:
- Ternary operator's syntax is a bit weird. My preference would be not
to have such an operator and require using [if ..] so that it's very
clear what's pre-processed even if it requires a bit more works.  We
don't want the INI files to become too cryptic. Also the syntax would be
better formed as ${value}?1:2 but again I think it's better not to have
it.
- I would prefer to see [ELSEIF] instead of [ELIF] to be consistent with
PHP. It would look weird for the same solution to have two approaches to
this.

Thanks!

Andi

> -----Original Message-----
> From: Marcus Boerger [mailto:[EMAIL PROTECTED]
> Sent: Saturday, February 09, 2008 6:33 AM
> To: PHP Internals List
> Subject: [PHP-DEV] [RFC] Conditional INI support
> 
> Hello PHPlers,
> 
>   attached is a patch against 5.3 that brings three feature additions
> to INI parsing.
> 
> 1) Ternary support for values
> 
>   setting = ${value?1:2}
> 
> If ${value} evaluates to true then setting becomes 1 otherwise 2.
> This cannot be nested and only works for values, not for setting
names.
> 
> 2) if-elif-else-endif support
> 
> [IF ${value} == 1]
> setting = 1
> [ELIF ${value} == 2]
> setting = 2
> [ELSE]
> setting = 3
> [ENDIF]
> 
> This can be nested. Alternatively we could use apache style syntax
that
> looks more like XML. The reason I used square brackets is that this is
> the smallest change to normal INI files.
> 
> 3) Add more values to INI parsing, namely:
> 
> ${php.version} = 50300
> ${php.debug} = 0
> ${php.zts} = 0
> ${php.sapi} = CLI
> 
> Any comments?
> 
> Best regards,
>  Marcus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to