Slashdot Mirror


Wikipedia Chooses Lua As Its New Template Language

bonch writes "In an attempt to tackle the inefficient complexity of its current template system, Wikipedia will be adopting the Lua scripting language. Known most for its use in videogame scripting, particularly World of Warcraft, Lua is lightweight and designed for easy integration into existing applications. The transition is expected to begin after the release of MediaWiki 1.19, possibly in May." Basically, the template system started turning into an ugly programming language. There was debate over using Javascript or Lua; Lua ultimately won due to implementation concerns. The mailing list threads announcing the decision and discussing the change have further details.

20 of 145 comments (clear)

  1. Stop delaying the inevitable. by MadKeithV · · Score: 5, Funny

    "the template system started turning into an ugly programming language" - ah, any sufficiently complex system eventually evolves to contain a limited, broken version of Common Lisp.
    Stop delaying the inevitable!

    1. Re:Stop delaying the inevitable. by dkf · · Score: 4, Informative

      "the template system started turning into an ugly programming language" - ah, any sufficiently complex system eventually evolves to contain a limited, broken version of Common Lisp.

      This includes Common Lisp, which contains itself as a proper subset.

      --
      "Little does he know, but there is no 'I' in 'Idiot'!"
    2. Re:Stop delaying the inevitable. by goldaryn · · Score: 4, Funny

      "the template system started turning into an ugly programming language" - ah, any sufficiently complex system eventually evolves to contain a limited, broken version of Common Lisp. Stop delaying the inevitable!

      LEEEEEEEROOOY JEEEEEENKIIIIIIIIINNSSS

    3. Re:Stop delaying the inevitable. by David+Gerard · · Score: 4, Insightful

      The trouble with domain-specific languages is that they are Turing complete. This is a fatal trap: your hammer may be a great hammer, but if it's Turing-complete you will (this is a law of the universe) one day be forced to use it as a screwdriver, spanner, soda siphon, and nail. You will end up having to build a working full-scale replica of the Titanic from toothpicks and spit, complete with iceberg.

      Your rule is more like - any domain-specific language will eventually evolve into brainfuck. ParserFunctions certainly did.

      --
      http://rocknerd.co.uk
  2. Sounds exciting by YutakaFrog · · Score: 5, Interesting

    Lua has some notable differences from more prominent languages like Java, but as a World of Warcraft addon developer, I find it a surprisingly robust and fun language to program in. I look forward to this change to Wikipedia and hope it works well for all of their contributors.

    1. Re:Sounds exciting by Talderas · · Score: 4, Funny

      I want a DPS meter addon for wikipedia.

      --
      "Lack of speed can be overcome. In the worst case by patience." --Znork
  3. Re:Let's Discuss having a Discussion about a Decis by Trepidity · · Score: 4, Interesting

    This seems to be at least partial evidence that that's not really the case: it was discussed for a while, a decision was made, and implementation rather than further discussion is now happening.

  4. Raw- or OOP-base Lua? by Phrogz · · Score: 4, Interesting

    I'll be interested to see if they go for WoW-style "raw", imperative Lua (gobs of functions) or a more OOP-style Lua (NB: my site).

    In designing the Lua interface for an old Game UI authoring product I originally went with OOP-style Lua. It was (IMHO) a rather elegant wrapper on our DOM. However, we soon found that the memory thrash of using Lua's lightweight userdata to go back and forth between C++ and Lua resulted in poor performance on consoles, and I ultimately had to redesign the interface to be more WoW-like for our next release.

    It was a shame, putting more onus on the scripter to manage objects (tables of properties in Lua) based on a 'pointer' passed around to uniquely identify each element in the DOM, and passing that pointer to all relevant functions. But the performance increase was dramatic.

    1. Re:Raw- or OOP-base Lua? by Phrogz · · Score: 4, Interesting

      BTW, my personal opinion on Lua:

      It's a fun language to learn, because at the core it is *so* simple. In less than a week a good scripter can fully wrap their head around everything that Lua has to offer from the scripting side (not the C++ side; that might be another week). It's rather elegant, really, with convenient syntax for integer-based for-loops that automatically create a new copy of the loop variable on each pass for simple closure creation.

      However, when you get down to actually typing in itwell, it's not as verbose as Java, but there's some real RSI danger there. With it's simple core come decisions like "not only will we not give you foo++, we won't even give you foo+=1". Try typing things like "frameCounter = frameCounter + 1" many times and you'll start to scream. Every day I scripted in Lua at work I would long for the times when I could use Ruby to actually get something done.

      For those who know JavaScript and want to get a glimpse of what Lua is like, I have a page on my site: Learning Lua from JavaScript.

    2. Re:Raw- or OOP-base Lua? by nahdude812 · · Score: 4, Informative

      There is a LUA PHP PECL extension: http://pecl.php.net/package/lua

      It's relatively new, but this kind of attention could really skyrocket the extension forward. It's a great idea at large, there are a variety of situations where you want to defer decisions to your customer. Historically that meant creating a kind of pseudo DSL with a bunch of forms to fill out for the customer, with hopefully most major options covered, but usually failing to satisfy a variety of corner cases.

      Another alternative is the V8JS extension (JavaScript). The advantage of JS is that more people know it already, and in may ways, JS is surprisingly elegant (not that Lua isn't). It won't perform as well as LUA though, and requires more resources to maintain the VM.

    3. Re:Raw- or OOP-base Lua? by pnot · · Score: 3, Insightful

      However, when you get down to actually typing in itwell, it's not as verbose as Java, but there's some real RSI danger there. With it's simple core come decisions like "not only will we not give you foo++, we won't even give you foo+=1". Try typing things like "frameCounter = frameCounter + 1" many times and you'll start to scream.

      Which, for me, immediately raises the question "Are there any good Lua IDEs?". I mainly code in Java, and it's true that it can often read like the Book of Deuteronomy -- but fortunately I don't have to type all that shit out, because NetBeans autocompletes a lot of it for me. Is there anything similar for Lua?

  5. Re:Lua by Anonymous Coward · · Score: 5, Funny

    Javascript is web scale. Lua is not web scale. Also: Lua comes from Brazil. You know what else comes from Brazil? Waxed balls. I wouldn't trust a programmer that waxes his balls. If he can't make good decisions involving his nutsack, can he make godo decisions involving language design? (Just look at PHP!)

  6. Re:Lua by james_van · · Score: 3, Funny

    That's a really valid argument. Im inclined to agree.

  7. Not a language problem by zarlino · · Score: 3, Insightful

    Wikipedia could stick to PHP or switch to any other language. But that's not their problem. Their problem is the messy markup language they slowly created. I know cause once I tried to render their markup inside another app. Basically, they have all sorts of tags that reference obscure server-side behaviour and everything is so entangled that creating a new renderer is basically impossible. This is sad because they are wasting the work of volunteers.

    --
    Check out my cross-platform apps
    1. Re:Not a language problem by David+Gerard · · Score: 3, Informative

      That's the precise problem. 1. the language was never designed, it accreted, and is mathematlcally impossible to describe fully in most sensible formats. 2. we can't throw it away because there's billions of words of text in it accumulated over ten years. 3. we can't throw it away because the existing editor base demand it stay because they're used to it.

      So WMF is (a) throwing money as well as brilliance at the problem, and (b) has put Brion Vibber onto sorting out what is to be removed from wikitext, because he's one of two people (Tim Starling the other) that people will accept the opinion of on this matter. All proceeds well :-)

      So now the problems are with seriously complicated things like doing bidirectional text properly - a hard requirement for an international project, and one that is not done quite properly by anyone else. Something where mere dev brilliance has half a chance :-)

      --
      http://rocknerd.co.uk
  8. Re:Lua by Hognoxious · · Score: 4, Funny

    Lua is a terrible language. It is also an excellent language.

    FTFY (see WP:NPOV)

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  9. Lua is Great for Configuration by alexbirk · · Score: 4, Interesting

    Embedding Lua for configuration or building templates is it's real strength. I've used it many times in programs that require pretty extensive configuration and it's a joy in that environment. I think it's a great choice for this.

  10. As opposed to a Wordpress style engine? by PortHaven · · Score: 4, Insightful

    Seriously, Wikipedia's #1 fault and the reason I ceased actively contributing is that it requires humans to use a mark-up language for what is essentially a simple text based document.

    And all such edits would be handled much easier via a WYSWIG editor. Yes, elitist monkeys with far too much time on their hands love that feel of doing something complicated for the sake of it.

    Those more intelligent and or beings who have furthered the race through reproduction tend not to want to waste time.

    Implement a simple editor that facilitates editing. And let computers do what they do best, process. And humans do what they do best collate ideas and knowledge.

    First rule of computers. Don't waste time doing what a computer can do better than you.

  11. Re:Let's Discuss having a Discussion about a Decis by svick · · Score: 3, Interesting

    Using Lua instead of the current template syntax will not mean much for editors of articles and nobody claimed it would. It will only make (huge) difference for those who currently write templates.

    On the other hand, there is also some work going on to make editing of articles easier using a WYSIWYG editor.

  12. Re:Lua by glwtta · · Score: 3, Funny

    I wouldn't trust a programmer that waxes his balls. If he can't make good decisions involving his nutsack, can he make godo decisions involving language design?

    Seems like a perfectly good decision to me. There really is nothing like a shorn scrotum, it's breathtaking; I suggest you try it.

    --
    sic transit gloria mundi