[asterisk-dev] CUT() default argument problem

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Nov 17 17:59:38 MST 2006


On Friday 17 November 2006 17:55, Steve Murphy wrote:
>         Defaults are only a good idea when there is a really obvious
>         choice that has almost no chance of being the wrong thing in
>         practice. Offhand, I can't think of anything that would meet
>         that criteria where CUT is concerned.

CUT was originally written to remove the CHANNEL unique identifier
appended to the end, which is why the '-' is the default character.

> What does the "Community" prefer? Should we act on shap's suggestion?
> I wouldn't have brought it forward if I didn't think it had some
> merit! Personally, I don't think the script to insert hyphens is
> doable or practical. But the rest of his proposal...? So, in 1.6 (now
> trunk), we would issue warnings about obsolescence. in 1.8, not
> having that argument specified would be an error... what do y'all
> think?

I think the reason for removing the default is lacking.  If I was
writing it today, knowing all that I've used CUT for, I would have set
the default to '|', as that character is unavailable with the current
syntax (but will be available for syntax in 1.4), but I see absolutely
no reason to change it now.  Getting the wrong result should be just as
much of a reason to check your syntax as getting an error message, so
that's not a good reason for changing it.

-- 
Tilghman


More information about the asterisk-dev mailing list