Live data from Hacker News

Ask HN: Any alternative to JavaScript in sight?

news.ycombinator.com

31–40 of 52 posts

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

#31

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.

Thanks. I thought I was the only one with this experience.

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

#32
post #30

Frankly I really like JavaScript. I don't want the language to change, even though it has its flaws. I just love the ability to have data-structures as simple as objects and arrays which have evolved into a standard data exchange format (JSON). Then you can also have functions inside objects and everything becomes really flexible and really easy to design. I've tried many different languages, including the real prett…

That flexibility is indeed useful for scripts and adding minor interactivity to an otherwise static web page.

However, people are now using JavaScript for development that far exceeds those uses. JavaScript is just not suitable for larger applications.

Once your application starts exceeding a few thousands of lines of code, the problems become very clear. You soon wish you were using a language like C++, Java, C#, Python, or Ruby. Toss in a development team made up of at least several people, if not more, and the pain becomes far greater.

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

#33
post #32
post #30

Frankly I really like JavaScript. I don't want the language to change, even though it has its flaws. I just love the ability to have data-structures as simple as objects and arrays which have evolved into a standard data exchange format (JSON). Then you can also have functions inside objects and everything becomes really flexible and really easy to design. I've tried many different languages, including the real prett…

That flexibility is indeed useful for scripts and adding minor interactivity to an otherwise static web page. However, people are now using JavaScript for development that far exceeds those uses. JavaScript is just not suitable for larger applications. Once your application starts exceeding a few thousands of lines of code, the problems become very clear. You soon wish you were using a language like C++, Java, C#, Py…

I was never able to personally judge that statement. My experiences show that the flexibility of JavaScript only improved maintainability of the software written in it.

http://npmjs.org/ is a list of solid software (also large software) written in JavaScript.

So I don't think your statement, about maintainability being connected with how flexible a language is, can be proven to be true.

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

#34
While I realize that Flash is no longer in vogue these days, ActionScript 3 is a really nice language and I'm surprised nobody else has mentioned it. It provides things like optional static typing for speed improvements, code clarity, and improved tooling/refactoring, as well as classes and packages for organizing larger code bases. It's more of what Brendan Eich envisioned JavaScript 2 to be.

That said, Apple is making it really hard for developers to choose it for all but intranet apps (for which it's really well suited).

I second GWT and the responses here have prompted me to look into CoffeeScript, so thanks for asking this!

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

#35
post #33
post #32

Earlier quoted context omitted.

That flexibility is indeed useful for scripts and adding minor interactivity to an otherwise static web page. However, people are now using JavaScript for development that far exceeds those uses. JavaScript is just not suitable for larger applications. Once your application starts exceeding a few thousands of lines of code, the problems become very clear. You soon wish you were using a language like C++, Java, C#, Py…

I was never able to personally judge that statement. My experiences show that the flexibility of JavaScript only improved maintainability of the software written in it. http://npmjs.org/ is a list of solid software (also large software) written in JavaScript. So I don't think your statement, about maintainability being connected with how flexible a language is, can be proven to be true.

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 taken. JavaScript cannot. You'll be hitting numerous maintenance barriers far before then, when you're still well under 10,000 lines of code.

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

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

CoffeeScript is only kinda "another language." It's very intentionally designed to map closely to JavaScript. Try it with an actual independent language like Python, Ruby or Haskell and you'll have more trouble.

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

#37
post #5
post #4

Why is JS not "reliable"? Any language can be a JS alternative. Do you mean you want an alternative language that runs natively in browsers?

"alternative language that runs natively in browsers" That's already been done: http://code.google.com/chrome/nativeclient/

That doesn't run in browsers, it runs in one browser — Chrome.

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

#38
post #35
post #33

Earlier quoted context omitted.

I was never able to personally judge that statement. My experiences show that the flexibility of JavaScript only improved maintainability of the software written in it. http://npmjs.org/ is a list of solid software (also large software) written in JavaScript. So I don't think your statement, about maintainability being connected with how flexible a language is, can be proven to be true.

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 maintainable even in JavaScript.

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

#39
Mozilla is working on Rust https://github.com/graydon/rust/wiki/Language-FAQ. Google has Go http://golang.org/.

To run compiled binaries from such languages you'll use Native Client http://code.google.com/p/nativeclient/ and Pepper APIs which let you access HTML5.

Go gets rid of some insecure low level things like pointers, keeps such things in an unsafe package to discourage its use. They intend to make it seamlessly compatible with NaCl. C/C++ code needs to be modified to work there.

JS is already not suitable for lots of stuff. Vendors are stretching its capabilities with big teams of fancy programmers implementing fancy VMs with big chunks written in assembler. At Google I/O they mentioned V8 is about as fast as it will get. Then bigger teams are writing massive APIs because even with fast VMs the language isn't fast enough to roll your own CSS/XAML/MXML/HTML parsers or 2D rendering contexts. So you're forced to wait or hack together things like LESS, CoffeeScript, Stylus in an attempt to communicate with the overlords.

With the browsers becoming the operating system for many users, you need a runtime that's as powerful as a regular operating system. Google and Mozilla are major players and it's nice to see them exploring alternatives.

But even if NaCl/Go is superior technologically, it may not overcome JavaScript's business and political momentum. As usual, technology is not chosen based on technological merit, but business considerations like legacy, lock in, etc. Perhaps NaCl/Go approach will succeed but it will be too little too late. Kinda feels that way with Flash and Browsers, they're finally serious platforms but might be too far behind Objective-C, C# and Java on mobiles.

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

#40

I would like to see an alternative to the WWW altogether. WWW is no longer a collection of hyperlinked documents, which was its initial purpose but a multitude of technologies running on browsers that use HTTP in nonstandard ways because it's ubiquitous. HTML is getting obsolete, with the most popular websites being essentially javascript apps. Maybe it's time for a new system like Java to create cross platform GUI a…

I believe the most popular website is essentially an interface for this collection of hyperlinked documents. Document browsing is still one of the killer features of web.

HTML is not a bad layout engine for GUI apps. It may not have been initially been designed as one, but after 15 years of development it seems to be pretty pleasant to work with as there are people who want to build their desktop apps with HTML.

Obviously, the standard request-response model of HTTP is limiting for interactive apps. Bi-directional communication within request isn't possible and handshaking is a bit too expensive. But hey, this problem is actually solved: http://dev.w3.org/html5/websockets/.

Post reply on HN