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.
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.
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.
I suggest to have a break and read lengthy blog post from Steve Yegge on this topic. He goes futher as the server-side js.
JSON is waaaay nicer than XML.
So JS could be logic data transport layer.
**** Steve Yegge. As if one ******* could possibly know it all.
I love the idea of shared services. Shared logic means more freedom in computing!