Here is a table summarizing the primary design goals of S2 and how they contrast with the existing style system, which I guess we can call S1:
|Flexible & Extensible||The current style system forces users to define a template for each new type of view: recent entries, friends page, day view, calendar, etc. If we want to add a new view type, users have to basically write their style.||In the new style system you describe the formatting of objects, not the formatting of views. Thus, we can easily add new views in the future, and making a "lastn" view pretty much makes ally your other views automatically.|
|Safe||The current system is completely safe. It's so brain-dead that it can't be anything but but safe. You have to have some intelligence to be harmful.||
The new style system is its own language that gets compiled into another language, and run on the webserver. Letting users run code on the server is inherently dangerous... it obviously has to be free of things "rm -rf /", but also, it has to be free from infinite loops, and anything that could consume large amounts of resources.
The S2 language does not have while loops, gotos, or any other control construct that would permit an infinite loops. It only has if/else blocks, and foreach over finite lists. Also, you can only call methods and functions defined in the core layer, so users can't write functions foo and bar which simply call each other.
|Fast||The current system is a CPU hog, doing tons of parsing, text munging and substitutions and run-time.||In the new system, S2 code will be parsed, checked, and compiled before the page is loaded. When a page is loaded in the future, the code will just be run, which will already be in the language that the LiveJournal server runs on. For LiveJournal.com, this will be Perl but in the future we could write a PHP or Java servlet backend to the S2 compiler.|
The current style system can support non-English languages and locales, but hardly:
-- The server injects a lot of English into S1 variables, especially in dates.
|The new style system is being design for internationalization. One of the S2 layers is an "i18n layer", which overrides English method definitions from the core and sets properties, like the day weeks start on.|
|Easy||Hahah ... the currently style system was never designed to be easy. It was designed for a few people (me, maybe a friend or two) to make styles, which we'd then make public. I never envisioned everybody using LiveJournal to begin with, much less trying to make styles.||Wizards and tools will generate S2 behind the scenes for most users. The hard-core users can write their styles and overlay layers in the raw S2 language.|