On Tue, Sep 2, 2014 at 1:34 PM, pi zero wn.pi.zero@gmail.com wrote:
On Tue, Sep 2, 2014 at 5:40 AM, Martijn Hoekstra < martijnhoekstra@gmail.com> wrote:
tl;dr: We've been collectively whining about templates for long enough.
Who
wants to help with fixing them?
Improving on templates is broadly what I've been doing with my dialog tools https://en.wikinews.org/wiki/Help:Dialog, which I've been working on for about three years and am hoping to start using seriously pretty soon (I've got a few more tweaks in mind to do first; after that, further improvements I expect to be driven by experience with serious use). I've been developing these tools using javascript under the hood, although I'm sure they could in theory be done better as a wiki extension, because I reckoned the design would need to be able to turn on a dime and I'd observed the wiki-extension approval process was, well, not.
The dialog tools mediate passing data from page to page, using elements specified using wiki markup, with the particular intent that a wiki community could use these tools to crowdsource wizards https://en.wikipedia.org/wiki/Wizard_%28software%29 entirely written in wiki markup.
Data is entered using input elements such as text boxes and dropdown menus, then passed to the next page via buttons, all placed via templates like {{dialog/textarea}}, {{dialog/button}}. At the receiving page, dialog data can go into other input elements, but can also be substituted for template parameters, and expressions using template-expansion can be used to specify values for input elements, so that the whole thing meshes tolerably well with the template system rather than competing with it. Each {{dialog/button}} specifies an action to be performed. The usual action in the middle of a dialog is "view", to display a page, but there's also an action "edit" --- hedged around with safeguards against abuse, of course; safeguards predicated on the assumption that admins are trustworthy.
In designing dialog-action edit, I uncovered something curious that hints to me (as a programming-language designer) that the whole concept of wiki templates might have been subtly flawed... though I don't imagine the flaw could have been anticipated at the time, and I agree wholeheartedly that at this late date, not breaking things is paramount. With the API edit action, there's an optional preload page; and I'd originally imagined that for dialog edit I'd want to allow the preload page to take template parameters; but when I actually started creating dialog edit, keeping in mind the sorts of wiki activities I was familiar with that one might want a wizard for, I realized that it was more natural to provide a "form" page that would be fully template-expanded to produce the raw content for the edited page. In techspeak, this difference between preload pages with template-parameter substitution, versus dialog-edit forms with full template-expansion to generate raw content, is essentially that the preload page is a macro < https://en.wikipedia.org/wiki/Macro_%28computer_science%29#Syntactic_macros
,
while the dialog edit form is a fexpr <https://en.wikipedia.org/wiki/Fexpr
.
This is what I consider an excellent example of the power of templates, and the power we want to have editors to have.
At the same time, it's also a great demonstration why templates suck so much as a programming language. I can't really imagine anyone being able to quickly (or, honestly, slowly) make much sense of https://en.wikinews.org/w/index.php?title=Template:Dialog/button&action=... and the amount of hoops it requires you to jump through to do something useful, like make a button.
If I quickly scan it it seems to be a template that conditionally calls a subtemplate with different parameters, that calls a lua module which is an interpreter for some custom dialect of Lisp, which evaluates the string passed in. All tied together with javascript.
If we have to resort to such magic to make templates do what we want, templates are quite simply broken; how can we explain that to a newcomer. "To help with these templates, all you have to know about are wikitext templates, our own implementation of lisp, Javascript, and Lua, and you'll be good to go". I suspect the number of people in the world who know how to do that is very close to 1. Especially for usecases like this, we need something less complicated.