Question

There are plenty of options for powerful server side languages, but I can't think of any strongly typed, truly powerful client side languages. Javascript does a lot with forms, basic math, and interacting with the server with AJAX and such, but it has it's limits when compared to other languages.

I'm looking for a strongly typed client side language capable of image processing or data crunching, raw things like that. Or if there are javascript libraries that help enforce data types of variables, that might work too.

Was it helpful?

Solution

In the browser as far as strong typing goes you have Java with GWT (static), Python (dynamic) with Pyjamas, Dart, Opa (static) and a bunch of languages that can cross compile to javascript from LLVM (C, C++, Objective C, Java, Ada, and many many others) thanks to emscripten.

In terms of performance you can take a look at Google Native Client and Javascript typed arrays.

Personally I think Opa is one of the most interesting web languages today.

OTHER TIPS

Haxe is a statically typed language that compiles to various client-side environments, e.g. JavaScript or Flash.

You might want to have a look at ST-JS. This tool allows you to write javascript, but borrowing the syntax and static typing of java. The tools provides a bunch of Java interfaces and classes that acurately reflect the standard javascript library, plus some other common useful libraries (DOM, jquery, etc...). You can then write your source code in java, and the ST-JS translater will transform that static-typed code into plain vanilla (and most importantly readable) javascript code. ST-JS is also compatible with any other javascript library that you would want to use, as long as you write the corresponding java interfaces.

Another advantage of ST-JS, is that since you are writing java code, you can use all the really powerful tools from the java ecosystem. Refactoring tools in all IDEs will work out of the box. Static analysis tools such as Findbugs, PWD, checkstyle also work great and are very accurate on ST-JS enabled code.

You can think of ST-JS as being somewhere in the middle between GWT (completely hides the javascript standard libraries from you, and prevents you from using external libraries) and some javascript static analysis tools such as JSLint.

TypeScript, Flow and Dart have optional static typing. TypeScript is a superset of JavaScript (you can annotate existing libraries with type information); Dart is a separate language that comes with a growing standard library.

Scala.js is another option. Its JavaScript interoperability is important to read.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top