Jump to content

Template talk:GamesName

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Template talk:GamesName/doc)

Optional xOG parameter?

[edit]

For year values >= 1993, theoretically couldn't we make the SOG|WOG parameter to this template optional? The type of games is implicit in the year, starting with the 1994 games. Requiring the type value after that point isn't really any sort of sanity check, even, because the template just breaks if you use the wrong value. It's not like it gives any sort of explanation why it's not outputting anything useful, to qualify as a "sanity check".

So I'm thinking something like

{{#switch:{{{1|}}}_{{{2|}}}
|SOG_1896=...
|WOG_1896=...
<!--...through 1992, then...-->
|#default={{#switch:{{{2|{{{1|}}}}}}
|1994=...
|1996=...
}} }}

So, the SOG|WOG would actually always be ignored for dates >= 1993, even if the user specifies it. For those later dates, the year will be taken from the second parameter, preferentially... and if there's no second parameter, the first parameter will be used instead.

That should allow things like {{GamesName||1994}} and {{GamesName|1994}} to be equivalent to the (still accepted) {{GamesName|WOG|1994}}, while still requiring one of either {{GamesName|SOG|1932}} or {{GamesName|WOG|1932}} and not accepting {{GamesName|1932}} or {{GamesName||1932}}.

Granted, it would make {{GamesName|SOG|1994}} display "Norway 1994 Lillehammer", whereas today it would show nothing. But that's arguably an improvement too, since the user is probably more likely to have the year right and the type of games wrong, rather than vice versa. FeRDNYC (talk) 23:47, 11 January 2023 (UTC)[reply]

  • I don't think this is a very good suggestion. A strict description of parameters (both in programming languages and in Wikipedia templates) is more of a plus than a minus, as it leads to a simplification of bugs catching and fixing. The {{GamesName|SOG|1994}} is a pretty good example precisely because we don't know if the year is right or the type of games is right. Therefore, we issue nothing (actually an error), so the bug becomes visible. Any assumption like that rather the year is right or the type of games is right - is not good, bugs become hidden. Nitobus (talk) 19:11, 12 January 2023 (UTC)[reply]
    @Nitobus: Granted, on further reflection this probably wouldn't play well with TemplateData... if I had it to do over from scratch, I'd put the year in the first parameter, and the second could just be optional when the year is > 1993.
    I don't quite understand this part of your argument, though: Therefore, we issue nothing (actually an error), so the bug becomes visible. {{GamesName}} doesn't do any sort of error reporting or checking, it doesn't populate any tracking categories for bad parameter values — it just silently outputs nothing for any type of parameter error. That hardly qualifies as the bug "becom[ing] visible", in my mind, since it relies on the user even noticing that there's something missing, and then making the connection that the reason for it may be that the template parameters are bad.
    You'd be surprised how easy it is for humans to overlook the absence of something, especially when it's a small detail in a larger context. For example, the wrong parameter in this call.
    (There's actually a {{GamesName|SOG|1995}} transclusion between "this" and "call" in the previous sentence, but how would anyone notice that something's missing there?)
    Sanity checking for mismatched post-1993 years / games-type parameters could of course be implemented, for times when the user specifies both. The idea would be that they shouldn't, generally, because it's redundant information; the year alone is sufficient. (The same way the year and city is always sufficient, even for pre-1993 games. Which is why {{GamesName|WOG|1932}} shows "1932 Lake Placid" and doesn't [need to] specify whether it's a summer or winter games.) But, certainly {{GamesName|SOG|1994}} could be made to output the same nothing, again, as {{GamesName|WOG|1995}} does — even though the former case feels like a missed opportunity to actually report useful information about the nature of the problem.
    But, yeah, in a TemplateData world it'd have to always be used as {{GamesName||year}} which is super unfortunate. (And that's assuming TemplateData even permits optional unnamed parameters before non-optional ones — most variable-length lists with positional elements sensibly require that optional ones go at the end.) FeRDNYC (talk) 04:40, 18 January 2023 (UTC)[reply]