[asterisk-dev] CUT() default argument problem
Steve Murphy
murf at digium.com
Fri Nov 17 16:55:55 MST 2006
I am sending out this message to help give "due diligence" to a bug
proposal by "shap" in mantis bug http://bugs.digium.com/view.php?id=7933
In this bug report, shap points out that the default CUT() function
separator char
is set to "-", which is sometimes a VERY BAD choice for things like
URLs, where
'-' commonly occurs as part of the string.
He proposes:
I meant to suggest eliminating any defaulting of the cut
criteria. The right way to go about this is to do one release
where warnings are issued about the default, and provide a tool
(a script) that will automatically insert the hyphens into
current scripts where they are missing. In the next release, the
absence of an explicitly specified cut criteria becomes an
error.
The reason to eliminate the default is (a) it will encourage
people to actually check those scripts when they learn why the
default is being eliminated, and (b) the current default
misleads authors into writing incorrect scripts (as occured in
the ENUM lookup script and various others).
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.
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?
murf
--
Steve Murphy
Software Developer
Digium
More information about the asterisk-dev
mailing list