Template talk:EB9
Appearance
(Redirected from Template talk:EB9/testcases)
Empty parameters
[edit]@PBS: Why is it a bad idea to pass through blank parameters? In your version the parser still has to expand all the {{{foo|}}}
parameters inside the {{#if:{{{foo|}}}|foo|HIDE_PARAMETER}}
statements to find out what the parameter name to pass is, so there shouldn't be any performance loss. There would only be a problem if {{Cite EB9}} treated blank parameters as different from non-existent ones, but it deals with that just fine. If you really want to save the overhead from passing the parameters up the template hierarchy to Module:Citation/CS1 then we would have to convert this template and Cite EB9 to Lua. I can do that if you think it's worth it. Best — Mr. Stradivarius ♪ talk ♪ 13:36, 12 November 2014 (UTC)
- @Mr. Stradivarius: It may or it may not deal with empty parameters fine, but one can not know that without looking into {{Cite EB9}} and one can not guarantee that in the future that will remain true. Even if you were to convert these templates it would not alter the issue that passing empty parameters into other templates is a bad idea, and generally it is not a good idea to duplicate functionality in templates (as you would have to do for the non standard parameters) as it means two places to maintain code.
- One of the problems with CS1 is that it does not have a null parameter (similar in concept to a null device under UNIX). Lets call it "null". If it existed then this problem goes away as "null" could be used here in place of "HIDE_PARAMETER". So if you want to improve CS1 then please add a null parameter to the interface. I have seriously been considering doing that myself but I really do not want to get involved in programming on Wikipedia so have not done so to date.
- IMHO the whole concept behind the Category:Pages using duplicate arguments in template calls is flawed when it is used as a bludgeon to change code such as this which does not have an error in it (see Template talk:Cite_EB1922#HIDE PARAMETER), but I am not going to waste time arguing about it if all you want to do is duplicate the parameters, but I think it is silly to change the code to introduce potential errors into it by passing empty parameters into other templates interfaces. -- PBS (talk) 14:16, 12 November 2014 (UTC)
- @PBS: Passing through blank parameters is standard behaviour and is done pretty much everywhere, though. Ignoring that fact is like shutting the barn door after the horse has bolted (and is several hundred miles away). If a template chooses to test for blank vs. absent parameters, it usually has a good reason for it, for example {{WPBannerMeta}} checking whether a WikiProject doesn't use a quality scale or whether the article in question is just unassessed. And writing templates with HIDE_PARAMETER makes the code harder to read, and puts them - and all the pages that transclude them - in Category:Pages using duplicate arguments in template calls. Also, Lua really wouldn't pass any empty parameters into other templates - the parameters and values are taken straight from the template invocation entered by the user, and handed directly to Module:Citation/CS1 (or wherever you want them to go). At no stage are any null parameters converted to whitespace. — Mr. Stradivarius ♪ talk ♪ 14:43, 12 November 2014 (UTC)
- We both agree I think that the scripting language has some very fundamental flaws.
- It is fairly common for people to script thus
{{{author|{{{first...
in this construction "first" will not be tested if author is set to empty. - CS1 is consistent with its handling of empty parameters only by being inconsistent on how it behaves if an empty parameter is passed in. The ignoring of empty parameters is a fundamental different way of handling parameters from the way they are handled in a standard template. In other words as a concept they are handled in exactly the same as they are in this template see for example the handling of "postscript" in {{cite book}} and "ref" in {{citation}}.
- At the moment if an unknown parameter is passed in to CS1 with a value set CS1 barfs. This is different behaviour from the way that standard templates work. This is not desirable and a null parameter that could be set to a value and ignored would be a useful addition for error handling. -- PBS (talk) 15:44, 12 November 2014 (UTC)
- @PBS: why was this necessary? as far as I can tell, I had already fixed the problem by appending 'BLANK_PARAMETER' when the parameter is empty, no need for some unique name contortions since the prefix to 'BLANK_PARAMETER' makes it unique. Frietjes (talk) 18:02, 14 November 2014 (UTC)
- I think it is a better method involving less changes to the original code, and hopefully we can agree on a null parameter which if set does not upset CS1 in which case changing this alteration to the code back to the previous will be easier to do. -- PBS (talk) 18:23, 14 November 2014 (UTC)
- seems like it depends on your definition of "less changes to the original code", clearly not in terms of bytes, but whatever floats your boat. Frietjes (talk) 18:56, 14 November 2014 (UTC)
- How so? Your change -59 my change +33. -- PBS (talk) 23:28, 14 November 2014 (UTC)
- lol, I could make it zero with whitespace adjustments. Frietjes (talk) 23:43, 14 November 2014 (UTC)
- How so? Your change -59 my change +33. -- PBS (talk) 23:28, 14 November 2014 (UTC)
- seems like it depends on your definition of "less changes to the original code", clearly not in terms of bytes, but whatever floats your boat. Frietjes (talk) 18:56, 14 November 2014 (UTC)
- I think it is a better method involving less changes to the original code, and hopefully we can agree on a null parameter which if set does not upset CS1 in which case changing this alteration to the code back to the previous will be easier to do. -- PBS (talk) 18:23, 14 November 2014 (UTC)
- @PBS: why was this necessary? as far as I can tell, I had already fixed the problem by appending 'BLANK_PARAMETER' when the parameter is empty, no need for some unique name contortions since the prefix to 'BLANK_PARAMETER' makes it unique. Frietjes (talk) 18:02, 14 November 2014 (UTC)