5 ms·
The difference is that Javascript is a crappy language and I resent having to write in it. In addition, it lacks types and is therefore slower and does not exec
by tomjen3 16y ago
The difference is that Javascript is a crappy language and I resent having to write in it. In addition, it lacks types and is therefore slower and does not execute the same way on all platforms.
- Groxx 16y agoNot the same on all platforms is a wholly legitimate complaint. It's frickin' annoying that browsers don't all implement the same language. But bytecode won't solve that. IE will still refuse to implement subset-X, WebKit will still prefix their CSS with -webkit, etc. Until everything settles down and decides on one implementation, in which case I'd still prefer to be able to read what the web is sending to me.
- exit 16y agominified js isn't much more readable than bytecode
- haribilalic 16y agoCrappy is subjective. I actually like JavaScript. JavaScript, although dynamic and loosely typed, does have types: string, number, object (including array, function and date), null and undefined are all JavaScript types.
- brainlock 16y agoI'd add that it has functions as first-class citizens and closures. Javascript has for sure some crappy parts, but there is also a lot of good in it.
- silentbicycle 16y agoI find Javascript depressing. If it had a few more years to develop, it could have been a really great language. I understand why it wound up that way, but, sigh. If you want to see a much better language with the same general design, look at Lua. It's made for scripting C programs rather than web pages, and it has had over a decade longer to mature.
- brainlock 16y agoWhy do you find it depressing? I'm not saying that there aren't better programming languages than Javascript. I'm just saying that there is a subset of Javascript which is really expressive and elegant.
- silentbicycle 16y agoThat elegant, expressive subset is basically Lua. It's been able to jettison most cruft over the years. I'm not a web developer, but every time I read/use Javascript, it feels like a broken fork of my favorite language. Javascript could have been that good, too. I like where Eich was going with it, but the browser wars etc. meant that shipping an early version made the most business sense, and design errors (which would have shaken out) got frozen in the spec.
- BrendanEich 16y agoSee http://wiki.ecmascript.org/doku.php?id=harmony:harmony http://wiki.ecmascript.org/doku.php?id=harmony:harmony and the pages it links in the first paragraph. ES5 strict (on which Harmony is based) removes or fixes some of the cruftiness. It's not the case that the Web dooms us forever to use JS as it was in 1995. That is simply false on a number of JS-specific points, but more generally: the Web's deployed-browsers-with-enough-market-share-to-matter intersection semantics moves over the years. It does not stay still or grow only compatibly. Bad old forms (plugins, especially, but also things like spacer GIFs used in pre-modern table layouts, not to mention old JS versions) die off. So, cheer up! JS can't be Lua, but it doesn't need to be. Its job is to be the best it can be according to its species and genus, its body plan. Which may be related to Lua's, but which was not and will never be the same as Lua's, because JS and Lua live in quite different ecosystems. A concrete example: Lua has coroutines now, but JS is unlikely to get them in the same way, interoperably. Some VMs would have a hard time implementing, especially where the continuation spans a native method activation. This is a case where Lua's single-source implementation shines, but that's just not going to happen on the web, in variously-implemented, open- and closed-source (the latter including clean-room, for fear of patents) browsers. So, we're aiming for Pythonic generators at most. If we go further than generators, I'll be surprised. Pleased too, don't get me wrong. However I doubt it will happen, because some on the committee do not want deeper continuations than generators, since greater than one frame of depth breaks local security-hat-wearing reasoning about what is invariant in JS's run-to-completion, apparently single-threaded execution model.
- kenjackson 16y agoIMO, the issue isn't if you like Javascript or not. It is is Javascript a reasonable language for compilers to target. I think the core proposal is that Javascript stays the defacto language of the web, but you build a standardized IL that all browsers target. Of course Javascript would be one of the core languages that would guide the design of the IL, because you don't want this new IL and Javascript to incompatible. The nice thing though is after you do that, other people can write new languages that target that IL, and they're not second-class citizens. It allows there to be real language innovation on the IL, just as there is language innovation on x86. The problem today is that JS is not a great language to target, and it relegates anything that targets it to second-class status (why are you using XYZ, why not just use Javascript?). I think its a great idea. IMO, this would be a far more important development than HTML5 for the life of the web.
- lincolnq 16y agoThen why don't you treat your JavaScript as object code, and compile a language you like better to it? It does not lack types (it just lacks static type checking); it is not significantly slower (JavaScript JIT is very advanced, and you're not compute-bound in JavaScript). And "it does not execute the same way on all platforms" is true for pretty much all languages on all platforms, so I don't know what you're getting at. If you'd like a better language I can suggest CoffeeScript and ghcjs.
- skybrian 16y agoJavaScript lacks 64-bit integers and binary data, just for starters. You can emulate these things (GWT does) but not efficiently. Byte code isn't necessarily the solution though. It might be a good idea to add these types directly to JavaScript, so they're usable both directly and as an object language.
- lincolnq 16y agoYes, it's true that it's utterly ridiculous that JS doesn't have integers. That's a definite lack of foresight on the part of the ECMAScript authors.
- chrisaycock 16y agoWe can add Skulpt (Python) to that list too.