Rotem Liss wrote:
There's a number of uses of {{switch}} that I'd rather not encourage. For example,
implementing a
mini-database of different texts within a single template:
http://en.wikipedia.org/w/index.php?title=Template:Lorem_Ipsum&action=e…
This would be much better handled by splitting it into 5 different templates, from a
server resource
viewpoint. This is true regardless of the implementation of switch. Another example:
http://en.wikipedia.org/w/index.php?title=Template:Mod_24&action=edit
This can thankfully be replaced by a mathematical expression, which is many, many times
faster than
any conceivable switch implementation. Generally speaking, {{switch}} is often used to
implement
functions which can now be better dealt with by writing PHP extensions. I didn't just
introduce 3
new functions, I also introduced an extension mechanism allowing people to write more.
This one:
http://en.wikipedia.org/w/index.php?title=Template:Db-meta&action=edit
could be replaced with something involving {{expr:{{NAMESPACEINDEX}}%2}} if someone just
created the
variable {{NAMESPACEINDEX}}.
Same with this, more or less
http://en.wikipedia.org/w/index.php?title=Template:TALKSPACE&action=edit
I'm willing to hear a case for the use of switch, but I'm not convinced of its
utility based what
I've seen.
-- Tim Starling