[asterisk-dev] European Asterisk Developer's Meet-Up: Last Call

Kevin P. Fleming kpfleming at digium.com
Wed Apr 29 09:18:37 CDT 2009


Tilghman Lesher wrote:

> I think it should be a function, not an application, as its function is to
> change a value, not to do something to the channel.  However, your point
> about preincrement or postincrement means that we probably need to alter
> the syntax to make that more clear.  Perhaps "++" ought just to be an operator
> in the expression engine?  That would enable the use of either preincrement or
> postincrement, according to context, and we wouldn't need a separate function
> or application.

It is not practically possible to do pre-increment or post-increment in
the Asterisk expression parser. The expressions are evaluated
depth-first and left-to-right, and when the INC() function is hit, it
will increment the variable and the remainder of the expression will be
evaluated.

You'd have to pre-parse the expression for these special magic
operations, then either do them all before the rest of the expression is
evaluated or do them after the rest of the expression is evaluated. Then
you also get into sequence points, what happens where there are multiple
 pre/post-increments in a single expression, etc.

I just don't see how this is a worthwhile effort to undertake, to be honest.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming at digium.com
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list