Hacker News new | past | comments | ask | show | jobs | submit login

Another option: get a language where markup itself is first-class syntax. JavaScript with E4X has XML built-in, which of course means XHTML if you like, which itself can be trivially translated to HTML if you prefer (as I do).

So just like regular expressions have first-class syntax, i.e., in JavaScript you can write either of:

  myRx = /somePattern/g;
  myRx = new RegExp('somePattern','g');
So with E4X you can write either of:

  greeting = <b>Hello, {user.name}!</b>;
  greeting = new XML("<b>Hello, "+user.name+"!</b>");
Though those really aren't equivalent since the second might be a XSS vulnerability, whereas the first is automatically escaped.

E4X only works in Mozilla-based browsers, but it also works just fine in Rhino, so you can use it in Helma (http://helma.org/) or any of the other Rhino-based frameworks or in Jaxer (http://aptana.com/jaxer).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: