Live data from Hacker News

Ask HN: Any alternative to JavaScript in sight?

news.ycombinator.com

41–50 of 52 posts

Re: Ask HN: Any alternative to JavaScript in sight?

#41
I don't think that the problem is that javascript is bad, but that it will kill most other scripting languages just by being in the right place at the right time.

It will be harder and harder for ruby/python/perl/x to compete with js in the future just because people know js and because it essentially runs everywhere fast.

WebCL, WebGL and friends will cover anything with extreme computational needs, and that will be everything you need to learn to write applications in the future, unfortunatly.

Re: Ask HN: Any alternative to JavaScript in sight?

#42

I think JavaScript will stick around for quite awhile. However, the viability and popularity of languages that compile to JavaScript will probably continue to increase. Besides CoffeeScript, which mostly only offers syntactic improvements to JavaScript, there are several projects which compile very different languages to JS, including: * Emscripten ( http://emscripten.org/ ) compiles arbitrary LLVM bitcode to JavaScr…

Since all of these compile down to javascript, they all suffer from at least some limitations of javascript -- the main one being performance. Yes, all browser manufacturers are trying to make it as fast as they can, but I sincerely doubt I will see the day javascript can run as fast as a statically typed and (jit) compiled language that isn't being executed by the browser. And when I say that, I don't mean little synthetic scenarios where some piece of javascript manages to be faster than something gcc spit out. I've already seen those, and they don't impress me any more so than a hummer being able to look like a ferrari if you get the angle and lights just right.

I'm a fan of P/NaCl for this reason. Their approach goes directly at the problem instead of banging on a square peg for years and years until it barely manages to fit through a round hole. By the way, that is the only way I can describe using html/js/css for application development at this point. If it makes me sound bitter/angry, it's probably because I've been doing it for too long and grown tired of how tedious and limited it is.

Re: Ask HN: Any alternative to JavaScript in sight?

#43
post #38
post #35

Earlier quoted context omitted.

By "larger applications", I wasn't talking about jQuery, Node.js or anything built upon them. I'm talking about real software systems with, at a very minimum, tens of thousands of lines of code. More realistically, we're talking systems with hundreds of thousands, if not several million, lines of code. C++ can scale up to codebases that large. Java and C# can handle it, as well. Even Python and Ruby can, if care is t…

Why do you think JavaScript cannot handle it? If you reach the million lines of code you probably have a really modular application, otherwise it's unmaintainable in any language. Being modular it can be sub-divided in many small layers which are the size of a jQuery library. I think your experience with JavaScript comes from reading code made by bad developers. If your software is written by good people it will be m…

I've worked on some larger applications in javascript (though nothing incredibly large), and I can tell you if I had the choice of using any language that offered static and strong typing I'd take it in a heart beat. A small change in one place often means an error in some part of your code you didn't even think would be affected. I've loaded 65k LOC JS files in firebug and webkit's debugger chasing some error down that was happening in some piece of code that I've never seen before. All because that's how far my screw up managed to travel when there is no type checking or strong typing. In that particular case I had set a string value to something that was supposed to have been an array. Something like that would never have happen in, lets say C#, but "crap"[0] or "crap".indexOf("c") or ["c", "r"].indexOf("c") are all valid JS.

Re: Ask HN: Any alternative to JavaScript in sight?

#44
post #19

The number of new features added to JavaScript in the past year is substantial. Between Canvas, WebGL, WebSockets, WebWorkers, Audio Data, TouchEvents, the number of permutations of new kinds of browser-based apps you can build will keep anyone busy for years. Then add NodeJS, and CouchDB, and the use of JSON as a data interchange and there are things you can do entirely in JavaScript that no other language can do. I…

Everything you listed actually has nothing to do with Javascript as a language. These are new frameworks for the and clientside APIs, not language features.

That's like saying the addition of the DOM did not improve Javascript. Standardized API's do matter, and do improve programming languages.

Re: Ask HN: Any alternative to JavaScript in sight?

#45

I'd like to see a statically typed language available. There is relatively little I do that requires dynamic typing, but so much of my experience would be better with static typing. I'm not saying to get rid of JS, but it would be nice to have a first class alternative.

JS is adding limited static typing in typed arrays: https://developer.mozilla.org/en/javascript_typed_arrays

Nothing about Typed Arrays is static typing.

Re: Ask HN: Any alternative to JavaScript in sight?

#46
post #29

Earlier quoted context omitted.

So i'm curious what you mean by "more suitable languages" for writing an mp3 decoder. Also which of Javascript's abstractions are do you think are so inherently unsuitable? As far as general purpose programming languages Javscript does pretty well with regard to object semantics. That's why things like Coffeescript are as powerful as they are. Javascript certainly doesn't have the elegance that say Ruby or Python has…

"Also which of Javascript's abstractions are do you think are so inherently unsuitable?" No, that's the wrong way of thinking about it entirely. When you create a language, you must unavoidably privilege some ways of thinking and working above others. You must make some things easier, at the expense of making some things harder. There's no one set of answers that works universally. Suppose I want to make an immutable…

The two things i have to say in reply to that. First, i think there's a lot of bunk common wisdom about tradeoffs as well. Scala's a great example of a coherent merger of object oriented programming and functional program, two paradigms that have for whatever reason been typically seen as oppositional (please note, i'm not accusing you of that, but i think it's reasonable to ask which things you think are unsuitable, understanding that there are tradeoffs). Second, when you're talking about suitability, i have to ask about what your constraints are. If all languages have their tradeoffs, then i don't see the problem with saying that JavaScript is as good a general purpose programming language as any other. Sure it's got tradeoffs, but JS as a language and as a programming platform has really hit a firm stride, and clearly has at least a couple years of solid growth ahead of it. Yes, JS like any other programming language, isn't perfect, but it is going to continue getting better and growing into new niches.

Re: Ask HN: Any alternative to JavaScript in sight?

#48
post #24
post #18

Earlier quoted context omitted.

An example that shows that Javascript wasn't designed for performance: it doesn't support integers. They can be used in some Javascript implementations that do smart tricks to convert float arithmetic to integer arithmetic, but it is not reliable. If you were designing a language for performance in the first place, this would be a ridiculous method to get access to integers. Same for dense arrays. Yeah, JS is pretty…

Dense arrays are coming in Harmony, thanks to WebGL. (JS.next) CoffeeScript incurs no penalty when compiling to Javascript; in fact, in many cases it's faster than handwritten code.

Yea, Coffeescript incurs no penalty because it's so close to Javascript, but therefore it doesn't fix Javascript's flaws either. Coffeescript still doesn't have proper lexical scoping and it doesn't have a good standard library.

Re: Ask HN: Any alternative to JavaScript in sight?

#49
post #43
post #38

Earlier quoted context omitted.

Why do you think JavaScript cannot handle it? If you reach the million lines of code you probably have a really modular application, otherwise it's unmaintainable in any language. Being modular it can be sub-divided in many small layers which are the size of a jQuery library. I think your experience with JavaScript comes from reading code made by bad developers. If your software is written by good people it will be m…

I've worked on some larger applications in javascript (though nothing incredibly large), and I can tell you if I had the choice of using any language that offered static and strong typing I'd take it in a heart beat. A small change in one place often means an error in some part of your code you didn't even think would be affected. I've loaded 65k LOC JS files in firebug and webkit's debugger chasing some error down t…

Dynamically typed languages offer a lot of benefits and a lot of burdens. Only you can judge whether you're willing to take those risks. Personally I am more comfortable with dynamically typed languages as they feel more natural and less programmatic, but this is just personal taste.

Nothing of this is related to the free-formness of JavaScript. Python and Ruby are also dynamically typed.

Re: Ask HN: Any alternative to JavaScript in sight?

#50
post #11

coffeescript - it's just javascript, but with a touch of awesomeness.

And without proper stack traces. Don't get me wrong, I love coffescript, but it clearly is a hack. The internet landscape would look very different if browsers had a standardized bytecode interpreter.

Not just a hack. Recognized developers such as Brendan Eich (creator of javascript) or Douglas Crockford (author of Javascript: The Good Parts) say that Coffeescript is good stuff. Coffeescript is a "transpiler", a source-to-source compiler wich translates a high level, very flexible and powerfull language such as coffeescript into plain old javascript. It doesn't change the underlying language at all, it keeps its object model and its data types. It just adds a more expressive and succinct syntax, inspired in python and ruby (and these languages have a very well deserved reputation for expressiveness and joy amongst programmers for a reason).
Post reply on HN