Categories
Mozilla Web Development

Embedded JavaScript For Web 3.0

John Resig has an interesting blog post on embedded JavaScript. It’s something I’ve been thinking about for a little while.

It would be awesome to see a PHP extension to embed SpiderMonkey into PHP. As far as I’m aware Facebook is the only one that’s taken a step in that direction with FBJS, which uses Mozilla source code. Perhaps that could be a starting point.

Considering the ubiquity of JavaScript, using SpiderMonkey, which is already available for Perl and Python, or Rhino (for Java) would make sense. It would allow for JavaScript to be for logic what XML is for data. In my mind that is nirvana for the web.

XML made our data portable. JavaScript can make our logic portable. Seems practical enough right?

For those who question security, it’s really up to the client to decide if it should parse JS, and what subset it should allow (perhaps no eval()). Having an API based on JS is really no less secure than any other language including one that’s home made. It’s advantage is that it’s used everywhere else and makes your API easier to work with.

This could be cornerstone of Web 3.0. Web 2.0 was largely about shared data and isolated small services. Web 3.0 could be about shared data and shared services.

5 replies on “Embedded JavaScript For Web 3.0”

Can someone explain to me exactly what embedded JS means? I write Perl code and JS as well. I keep them separate. Is the idea of embedded JS to write JS within the Perl scripts I write, and have it run server-side? I can’t see the benefit of that. I must be missing something since I scanned Resig’s post as well.

@pd: The advantage is having a way to let others write code that integrates into your system, similar to how Facebook has a platform which developers can write applications for. They need to do things server side, but you don’t want them writing Perl. Easier to sandbox, and less of learning curve (which means more adoption). JS is perfect for it.

**** Steve Yegge. As if one ******* could possibly know it all.

I love the idea of shared services. Shared logic means more freedom in computing!

Leave a Reply to pd Cancel reply

Your email address will not be published. Required fields are marked *