User:Fran Rogers/Project Turing
Ideas to bring Turing-completeness to wikitext, as elegant and usable as possible. Add your ideas if you'd like. :)
- {{#def:}} - creates a new parser function in the current scope. (Lexical scoping hopefully.)
- Elementary functional programming stuff like {{#and:}} and {{#or:}}
- Tail call optimization
- Well-defined "libraries" stored somewhere in MediaWiki: or Template: space. Hopefully cached/byte-compiled/etc.?
Example: {{#def:repeat|{{{2}}}{{#ifeq:{{{1}}}|0||{{#repeat:{{{1}}}|{{#expr:{{{2}}}-1}}}}}}}}
Significant whitespace is a huge problem... what can we do to make complicated code actually readable?
Maybe something like this - wrap code with whitespace to be ignored in special syntax:
{\
{{#def:repeat|
{{{2}}}
{{#ifeq:{{{1}}}|0|
|
{{#repeat:{{{1}}}|
{{#expr: {{{2}}} - 1}}
}}
}}
}}
\}