[OpenSER-Devel] 'while' statement in config file

Henning Westerholt henning.westerholt at 1und1.de
Wed Sep 12 10:52:57 CEST 2007


On Tuesday 11 September 2007, Daniel-Constantin Mierla wrote:
> Hello,
> [..]
> Maybe some of you noticed that in the ongoing process of improving the
> pseudo-variables system, the AVPs and HDRs can be accessed with dynamic
> index. That means next lines are correct in the config file.
> [..]
> The question I want to address is whether makes sense to add 'while'
> statements to iterate through avps or hdrs. More or less, the cycles can
> be done via recursive routes.
>
> The block:
>
> $var(i) = 0;
> while($(avp(i:20)[$var(i)]) != null) {
>  .....
> $var(i) = $var(i) +1;
> }
>
> is equivalent with:
> [..]
>
> 'while' may look more attractive, but could open the pandora box, people
> asking for more and more, that will turn config language is something
> very complex (not saying that is simple now :-) ).

Hello Daniel,

both ways are fine with me, but the while syntax is of course more appealing. 
In regards to the "open the pandora" question, in my opinion we should try to 
limit the config language to a simple procedurable one.

So conditionals and simple loops are ok, but we stay away from inheritence, 
templates, objects.. And i don't think we need three different loop types, 
one "while" or "for" should sufficient.

Cheers,

Henning



More information about the Devel mailing list