If you say find C-style syntax to be in the axis of evil are you just hopelessly condemned to suck it up and deal with it if you want to provide your users with cool web 2.0 applications - for example stuff that's generally done using JQuery and Ajax etc? Are there no other choices out there? We're currently building intranet apps using pylons and a bunch of JavaScript along with a bit of Evoque. So obviously for us the world would be a better place if instead something equivalent existed written in like PythonScript. But I've yet to seen anything approaching that aside from the Android system's ASE - but obviously that's something rather unrelated. Still - if browsers could support other scripting languages....
views:
174answers:
4There's GWT that compiles Java to Javascript. In theory, you could do the same for any language. Additionally, for instance, Python can run on a JVM, so perhaps there's a way to plug Python into GWT.
There's also http://pyjs.org/ and probably other similar projects.
I'm of the opinion that you should just get over it, but there are some non-C-style options that "compile" down to JavaScript:
- CoffeeScript is inspired by Ruby and Potion
- Pyjamas is a port of Google Web Toolkit (Java) to Python
Other language supported by "some" "browsers" is VBScript, but.. you don't want to go there.
The support for other languages is still work in progress.
What you can get today is to have a framework or library to translate one language into JavaScript
Here are some of them along with a small sample:
GWT - Java
// Add a button to remove this stock from the table. Button removeStockButton = new Button("x"); removeStockButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int removedIndex = stocks.indexOf(symbol); stocks.remove(removedIndex); stocksFlexTable.removeRow(removedIndex + 1); } }); stocksFlexTable.setWidget(row, 3, removeStockButton);
Pyjamas - Python
def greet(sender): Window.alert("Hello, AJAX!")
CofeeScript - ( Ruby like )
square: (x) -> x * x cube: (x) -> square(x) * x
Pyscript - ( Python like )
// Example One function triangle(a,b): function sqroot(x): return Math.pow(x,.5) return sqroot( a*a + b*b )
From this, GWT is the most robust.
If you want "native" web 2.0 app, try GWT or Pyjamas. Otherwise you can use proprietary plugins: Silverlight, Flash, JavaFX. You can use IronPython (.Net Python implementation) to write Silverlight application.