#5480 - Rewrite do_lang and do_lang_tempcode to not ignore params when previous params are null

This is a spacer post for a website comment topic. The content this topic relates to: #5480 - Rewrite do_lang and do_lang_tempcode to not ignore params when previous params are null
It is done the way it is for performance reasons. Looping over 3 inputs for every language string referenced is not trivial when thousands may be. Let's say there's 1000 language strings being referenced, and the difference between checking 1 vs 3 parameters is a microsecond. That's 1 millisecond. Let's say our performance budget is 200 milliseconds.. that's 0.5% of our performance budget just for this one tiny thing that can be avoided by not providing parameters incorrectly.
I think an alternative then should be a new automated test if there isn't one to check for these cases where a null parameter is passed before a non-null one. There are instances of this in the v11 codebase.
Fundamentally it's impossible to do fully with linting, as most cases of this will be happening when variables are being used rather than static values.

What would work is in dev mode checking the parameters are valid at the start of the function. Then it's much harder for us to miss, during our basic development cycles.
So are you suggesting a dev mode clause within the do_lang / do_lang_comcode functions where if a parameter has null and a later parameter does not, we warn_exit about that?
Yes
Okay, I can do that.
0 guests and 0 members have recently viewed this.