Strongly typed client side languages?
Asked Answered
H

5

9

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.

Hydro answered 30/6, 2012 at 1:29 Comment(5)
Do you mean statically typed?Daub
I think you're talking about Flash, although HTML5 is encroaching fast ...Holmun
Static typing is a step in the right direction. Flash is compiled and requires plugins and seems to be on its way out.Hydro
@CoreyOgburn: you've used the word "powerful" without explaining why Javascript isn't powerful. No one will know what you are looking for.Daub
What's a client-side language?Prelusive
B
5

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.

Battology answered 30/6, 2012 at 2:5 Comment(0)
W
2

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

Wayland answered 24/8, 2012 at 12:10 Comment(1)
Ugh, flash... But with javascript as an option I'll check it out.Hydro
W
1

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.

Wayland answered 14/11, 2012 at 11:46 Comment(1)
Dart hasn't static typing as an option. You can write types, but they will have meaning only for you and IDE, when VM will strip them as comments.Mete
M
1

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.

Mischa answered 30/12, 2012 at 17:33 Comment(1)
it's just transpiler.Mete
W
0

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

Wayland answered 7/4, 2015 at 13:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.