A while ago, StringFunctions got merged in with ParserFunctions.  Tim
disabled them by default before scapping, with the following comment:

/**
 * Enable string functions.
 *
 * Set this to true if you want your users to be able to implement their own
 * parsers in the ugliest, most inefficient programming language known to man:
 * MediaWiki wikitext with ParserFunctions.
 *
 * WARNING: enabling this may have an adverse impact on the sanity of
your users.
 * An alternative, saner solution for embedding complex text processing in
 * MediaWiki templates can be found at:
http://www.mediawiki.org/wiki/Extension:Lua
 */

I'm sure we all agree that wikitext is terrible syntax.  But some of
the string functions already are at least partially replicated (with
horrifying inefficiency, and significant limitations in some cases) on
enwiki anyway.  Specifically:

* #len is implemented by [[Template:Str len]].  Running {{str len}} it
on a string of 250 a's gives preprocessor node count 152, post-expand
include size 4597 bytes, template argument size 7430 bytes.
* #pos is implemented by [[Template:Str find]].  Trying to find b in a
string of 250 a's gives preprocessor node count 1354, post-expand
include size 5740 bytes, template argument size 50320 bytes.
* #substr is implemented by [[Template:Str sub]].  Using the same
string of a's, with start 30 and length 20, gives preprocessor node
count 1534, post-expand include size 13400 bytes, template argument
size 44578 bytes.

Is there any good reason not to enable these three string functions, at least?

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to