[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why IS Lua Used (was: Why isn't Lua more widely used)
- From: Jay Carlson <nop@...>
- Date: Wed, 1 Feb 2012 17:48:30 +0000
On Tue, Jan 31, 2012 at 6:02 PM, Petite Abeille
> Wikipedia chooses *Lua* as its new template/macro language
> Why "Lua" is on everybody's lips, and when to expect MediaWiki 1.19
When I first went browsing through the source looking for the parser
in MediaWiki's processing pipeline, all I saw was a bunch of regexp
substitutions run in a chain finally arriving in HTML. I said "good
lord, that can't be the actual way they do things, doing it all in the
string domain will lead to endless cross-site scripting
vulnerabilities and other nasty bugs". Well, I go look at the release
history, and I see a bunch of hard bug-fix point releases to hack
around XSS vulns, etc etc etc.
If you're curious, see
http://www.mediawiki.org/wiki/Markup_spec#Parser_outline for a prose
summary, and the rest of that page for people trying to come up with
any kind of *meaning* for MediaWiki markup.
In the several years since I last looked at this, some progress has
been made by third parties in producing parsers and grammars. I think
it's a shame MediaWiki didn't ever pick parse->expand->serialize as
their infrastructure project instead of taping Lua on the side--and
adding Lua as a decorator to a structured document is really easy. As
lpeg's re module demonstrates, it is not that difficult to write
alternative syntaxes if Lua's syntax is too verbose.
Why yes, this is exactly the "manipulate structured things as
structures, not as strings" rant from last week. It doesn't help that
PHP historically was not really able to manipulate structures in any
kind of accessible/performant way. Programming languages matter.
(And of course you should be able to manipulate Lua source, a very
structured thing, in the structure domain as well, but now I've
wandered back to Metalua. Typical.)