S2 Styles
An Object Oriented Programming language used to design styles for Live Journals.
I think this looks like a horrible mistake. XSLT would have been a better solution. The FAQ links to <lj:evan/601685>, a journal entry which it claims is about how ugly XSLT is, but if you actually read it, it's a guy saying "I don't know how to do this! XSLT sucks!" and another guy going "You do it like this.", and then the first guy going, "Oh, i get it; XSLT rules!". There's also some difficulty caused by the fact that the starting XML was shittily designed, which of course is going to make using an XML processing language difficult. By the time <lj:logjam_dev/3276> gets written, things are much improved. So, what i'm saying is, S2 sucks. Shit, even if they didn't like XSLT, plain old Python Language running in a sandbox would do the trick. As a rule, inventing a whole new programming language is very rarely the right solution to a problem (just look at the junk in unix if you want proof). But then the Live Journal admins haven't got a good track record in finding the right solutions to problems.</rant> -- TA
OK, so what about the points raised here: <http://www.livejournal.com/doc/s2/faq.html#faq.newlang>?
Let's look at them one by one, with the counter-hypothesis of doing it all in XSLT.
- "[We reinvented the wheel because] The other wheels weren't round"; this doesn't even mean anything, so it's hard to attack it
- "Safe.pm isn't too safe"; XSLT is safe by construction (it doesn't even include unsafe concepts like files and sockets)
- "By making our own domain language, we make it easy to do the things which are common/specific to this problem", some of which include ...
- "The common operation is print. So we made an expression statement starting with a string literal be a print statement on that expression."; i'm not an XSLT expert, but i believe that something similar applies; parts of a template which aren't XSLT directives are output directly
- "Large blocks of text are printed often, so we wanted the Python-style triple-quoted string literals."; in XSLT, the literals don't need any quoting at all
- "We wanted layers of functionality/overridability."; as discussed briefly at <http://www.livejournal.com/users/evan/601685.html?thread=3230549#t3230549>, this is possible in XSLT - since every XSLT transformation turns XML into XML, you can chain layers of transformations together (as long as the specific kinds of XML are compatible)
- "We wanted a graphical wizard to be able to look inside the layers and see what options are available."; XSLT has parameters, which are specifically designed to have options sent in from outside. It should be possible to write a tool which inspected styles to identify the parameters.
- "It wasn't that hard."; XSLT already exists, and there are Open Source implementations (Xalan and Saxon)
- "The language is very similar to other languages which geeks are already familiar with. The learning curve isn't too steep."; ah, well XSLT is an established standard, but it's pretty radically different to common programming languages, so it might be a pain to learn. However, one suspects that it's different because being how it is is the right way to be for the job it does.
And after all, isn't "it won't do things exactly the right way, so I'll just start from scratch" the mentality that lead to this wiki...?
At the time it was written, all the other wiki engines around were really bad. There are currently many very well-designed and well-implemented programming languages about. Also, the writing of the wiki was as much for fun as for the end result.
Hmm: <http://lambda.weblogs.com/discuss/msgReader$8805>. Maybe i'm wrong. I don't know. -- TA
Category Geekery