Hacker News new | ask | show | jobs
by eagsalazar 5140 days ago
On the one hand I get why people are excited about this and why people like coffeescript, especially when source maps start working in inspector/firebug. You can write web apps in the language you love and know. Cool!

On the other hand, this really sucks. Javascript is just maturing to where it is really awesome! And there is a ton of collaboration among app developers because javascript was the only game in town for so long.

Of course people will continue to collaborate but not, I fear, at the same level. 3rd party libraries will continue to be available, but not as many will fit in so neatly with people coding in other languages.

This has already come up a few times with coffeescript and in a couple years when it is truly easy for people to work in other languages, we'll have a tower of babel effect.

JS is really good. It isn't that hard to learn if you already know other languages. It has warts but it is also very powerful so often it is worth it (check out the lines of code and speed vs other languages):

http://shootout.alioth.debian.org/u32/javascript.php

4 comments

JS is not really good, sadly. Harmony is looking better all the time, but still nowhere near as sane as most other dynamic languages.
I think that NaCl is more geared towards being a target of a port for an existing application thats been written (like the supreme commander game that google managed to coerce a studio to port to NaCl).

I htink the pie is big enough for both NaCl and javascript apps.

> I think that NaCl is more geared towards being a target of a port for an existing application thats been written

It is, but you can also port existing applications to JS.

> I htink the pie is big enough for both NaCl and javascript apps.

It's a different pie. NaCl is chrome-only (and just enabled in the chrome store, in fact), while JS runs in all browsers.

> It is, but you can also port existing applications to JS.

You can't just port things to JavaScript the same way. JavaScript is a very different sort of language. "porting" something to JavaScript pretty much always means remaking the whole thing from ground up and hoping that your pixel pushing in canvas runs at an acceptable speed.

Actually Emscripten allows you to port an existing native application to JS, and the development effort is comparable to using NaCl.
Yup. They've ported all sorts of things with Emscripten, including, I believe, Ruby, Python and Perl.
Yes. But it's a POC thing that's also some orders of magnitude slower...
It's not orders of magnitude slower, most benchmarks have it 2x-6x slower. It's rarely slower than 10x (one order of magnitude). And that is before JS engines even start to optimize for it.
You might want to read http://mozakai.blogspot.com/2012/05/emscripten-opengl-webgl-... for some eye-opening about what one can do with porting to JS in a _modern_ browser.
How much JS have you actually written?

It is a crap language designed in an afternoon and nowhere near good enough to solve the problems we currently use it for.

Just a few things of my head: 'this', 'var', no integers, semicolons, no block scope.

I have written a lot of JS since my humble beginnings in 1997 where I wrote an "ajax" chat system running down to Netscape 2 and IE3.

There's no point in dismissing JS due to simple lexical issues; those have in no way prevented us from maturing the language use through idioms, patterns, tools and collective knowledge.

JS is more than good enough as a basis for CoffeeScript and Emscripten - so why should we care whether scope context or a lack of block scope can be initially confusing?

"var" and "no block scope" are horrible.

"No integers" is bad.

"this" can swing either ways. It provides some cool possibilities.

"semicolons" however (either the presence or the removal of) is a totally inconsequential and trivial syntactic thing.

Removing semicolons doesn't even buy you what a small amount of syntactic sugar buys you. You saved a few keystrokes. Big fucking deal.

I'ver never understood how the "this" thing actually brings possibilities. If anything, it introduces unnecessary confusion about scoping/binding. Python and Ruby don't have "this" and do just fine.
Well, Python has "self", that you have to explicitly pass. Not the best example.
But Python's methods already have self curried in. Class.foo(self, x) takes two arguments, but instance.foo(x) already has self bound, and only takes on argument.

This lets you do bar = instance.foo; bar(x) and it'll still work. Much more consistent.

You're right about Javascript, but those benchmarks you link to are completely useless. Take a look sometimes at the actual code.
Your complaint is "completely useless" - say specifically what you think is wrong and point to examples.

If you think you could write better programs then write better programs and contribute them.