Talk:Fixing templates

Latest comment: 9 years ago by Tony1 in topic Moving this discussion to mediawiki.org?

Quasi-quotation edit

Some of the most esoteric features of template calls have to do with regulating what does and doesn't get done at different times. This is a familiar problem, with a straightforward cause. It happens also with the notoriously complicated "quasi-quotation" device of Lisp.

The problem is that, as soon as you introduce any sort of device that manipulates text — even something as innocent as the #if magic word (to be clear, I approve of #if, as straightforward and exceedingly useful) — you have also introduced a distinction between text before it's been processed, and text after it's been processed. There are two different ways to handle this. It's usually done (for example, in Lisp) by means of "quotation"; that is, everything is to be processed unless it's specially marked as not to be processed. But then, within a large block of stuff that's not to be processed there may be a bit that should be processed after all, so you introduce more special syntax to mark that bit. And so on. It gets both messy and confusing. The confusion is made even worse when you also have some device that works by substituting its parameters into a pattern — which is how templates work, and is in general called syntactic macros.

There is an alternative, that can be much simpler. The bizarre technical term for it is fexprs. The idea is that when you specify an operation with a bunch of parameters, such as a template call, the parameters aren't to be processed until and unless you explicitly specify that they're to be processed. The advantage of this is that you never have to introduce additional syntax for exceptions going back and forth: everything you specify is in the direction of saying that something is to be done.

It would be a really, really bad idea to break things by ceasing to support stuff that's already in place. It isn't directly useful to be able to design, with 20/20 hindsight, a system that would have been much better if we had gone with it in the first place instead of the existing system. But maybe we can devise a way to evolve/guide things, moving forward, such that in future there'd be no reason to use those esoteric features for anything newly written. --Pi zero (talk) 14:38, 4 September 2014 (UTC)Reply

Moving this discussion to mediawiki.org? edit

Not to bikeshed, but there is a benefit in focusing all the technical discussion in mediawiki.org. Please consider moving this page there.--Qgil-WMF (talk) 08:39, 22 September 2014 (UTC)Reply

That does sound like a good idea. Tony (talk) 08:50, 22 September 2014 (UTC)Reply
Return to "Fixing templates" page.