views:

174

answers:

4

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....

A: 

There'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.

alex
Thanks alex that looks interesting.
Khorkrak
+3  A: 

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
Jordan
Yeah I can deal with JavaScript it's just that it's like damn this is bleah. Similar to when you have to read through / edit someone's Perl, PHP code or XML document. Stuff that's just so often not meant for human consumption unless written by very thoughtful developers. I value readability and flexibilty so I like Python's syntax and find YAML way better to look at compared to XML and so on. My bias naturally.
Khorkrak
+4  A: 

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.

OscarRyz
I like that Pyscript one. I remember seeing Pyjamas a few months back but haven't yet played with - showed my boss and he was like ugh it's so slooooow. But I will give it whirl myself to see.
Khorkrak
A: 

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.

Roman Bataev
Yep we use Flash and considered Flex as well. Running on linux here so .Net is right out.
Khorkrak
There is an open source implementation of Silverlight called Moonlight. It runs on Windows, Linux and Mac OS X.
Roman Bataev