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

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Apr 29 09:03:49 CDT 2009


On Wednesday 29 April 2009 05:45:13 Benny Amorsen wrote:
> Matthew Nicholson <mnicholson at digium.com> writes:
> > Also I think there should be an optional argument for how much to
> > inc/dec (${INC(VAR,2)}).
>
> That syntax looks like you're using it as a function, not as an
> application. Does the function as written increase the value of VAR as a
> side effect, or does it just return the value of VAR + 2? Does it
> preincrement or postincrement?
>
> If this ends up being implemented, please just make it an application
> with the syntax INC(VAR,2), and don't let it return anything.

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.

> By the way, I only just realized that Asterisk has a SET function. What
> does it return?

The SET function returns the value of the variable, as it was set.  The intent
is to be able to obtain the intermediate value in a calculation and store it
in a variable.

-- 
Tilghman



More information about the asterisk-dev mailing list