[Asterisk-Dev] Function format

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri May 20 10:35:10 MST 2005


On Friday 20 May 2005 01:33, Olle E. Johansson wrote:
> Leif Madsen - Certified Asterisk Consultant wrote:
> > On 5/17/05, Tilghman Lesher <tilghman at mail.jeffandtilghman.com> 
wrote:
> >>As soon as you nest that deep (3 or more levels), it's going to
> >> look ugly, no matter what the syntax.  It's not that big a deal;
> >> move on.
> >
> > I disagree. By having curly braces you end up up doubling the
> > number of closing braces required. While I'm not a parsing expert
> > in Asterisk, I believe something like the following would be easier
> > to read:
> >
> > Original:
> >
> > exten => 100,n,Goto(${IF(${EXISTS(${DB(foo/bar)})})}?:novalue)
> >
> > Proposed(?):
> >
> > exten => 100,n.Goto(%IF(%EXISTS(%DB(foo/bar)))?:novalue)
> >
> > You end up with half the number of closing braces, and is much
> > easier visually on the eyes.
>
> Agree. The % construct makes more sense and is easier to distinguish
> from the variables. It will be much easier to teach a newbie.

% construct is also used as the modulus operator and might have a
confusing syntax with functions embedded within expressions.  That makes
it not an option.

I'm generally against trying to change the function syntax at this point
in time, unless someone comes up with a really nice alternative syntax.

-- 
Tilghman



More information about the asterisk-dev mailing list