JavaScript is a scam

+1 to high level IR. And esp. a tree structured IR rather than “flat”. Couldn’t really care less about how it’s transported (bytecode or source).

As much I as like LLVM, it’s not the ideal (IHMO) transport method. But it would be much better than anything we have today.

From my perspective the ideal transport method is lzma pack200’ed jar files :slight_smile: I suppose only time and motivation is stopping someone hacking on Chrome to implement JamVM like this. Would be exactly what the HotJava browser failed to be*

Cas :slight_smile:

There are some advantages to a source-level specification and not a bytecode one – different architectures can compile it in radically different ways, which is harder when you have assumptions about a machine model encoded into lower level code. That’s the rationale the OpenGL ARB gives for not having a bytecode format for GLSL anyway, and it’s a little bit weak but not totally without merit. Same argument could possibly apply to the scripting runtime for browsers too. I think we can all agree that Javascript is a pretty terrible compiler target though.

Web servers and browsers already support compression whilst sending over data. It would be much better to have better compression there, so HTML, CSS and other items can benefit too. However I heavily disagree about wrapping it all up into one file. It prevents parallel downloads, using multiple CDNs, works against caches and increases startup time longer. Any large web game or application should also have it’s content streamed as you are using/playing it, so it appearers like it downloads instantly. More should be done to make this more natural then it currently is. Wrapping all content into one file is like taking a step back from that.

[quote=“sproingie,post:23,topic:37455”]
If you use === instead of == in your language, then most of the quirks (like 0 == ‘’) go away. All of the closure and prototype stuff then allows you to build pretty much anything on top, as it’s such a flexible language. So I’d disagree with you.

Funny, I use JavaScript daily and run a single-page-app framework with thousands of lines of code and I’m using classes. Seems to work just fine. And it’s not a regular web page app, it’s designed for television, meaning all input interaction must be coded and handled in code.

Just because you don’t know better doesn’t make JavaScript bad, there are tons of libraries out there, frameworks, etc. that can help tremendously.

being neutral toward JS
I gotta say “scam” ? It’s free and nobody forces you to use it (besides maybe your employer) - so how is it a scam ? =P

You’re barking up the wrong tree, this is a Java forum. Other than that, Javascript is an excellent language once you grasp the specification. It’s a functional language that looks like an object orientated language, which causes a lot of confusion and results in incredibly crappy example code and tutorials all over the interwebs. Please don’t let the incompetence of others influence your perspective on this language. The only thing Javascript desperately needs is a rocksolid IDE.

I kinda like http://jsfiddle.net/

You can’t be using classes, because Javascript doesn’t have them. You are using a hack you think it is smart because nobody else noticed how much time you waste with this crap yet.

I know exactly what JavaScript can and cannot do. And it is far from excellent. As a matter of fact it is the exact opposite of it.

Functional and object orientation aren’t mutually exclusive, so I don’t know what you mean there. JavaScript code looks like crap because the language itself is crap and the developer is fighting all the way through in order to get something sensible running.

Have you even looked at libraries like JS Class?

var Animal = new JS.Class({
    initialize: function(name) {
        this.name = name;
    },

    speak: function(things) {
        return 'My name is ' + this.name + ' and I like ' + things;
    }
});

var Dog = new JS.Class(Animal, {
    speak: function(stuff) {
        return this.callSuper().toUpperCase() + '!';
    },

    huntForBones: function(garden) {
        // ...
    }
});

Looks very neat and tidy, and even supports standard things like calling super methods, interfaces, hooks for meta programming, full reflection for it’s OO system, and being able to attach Ruby style blocks onto methods.

That’s really the point of JS, that you can build something like this.

You can have something like classes and you can have inheritance, mixins, traits, and all that other stuff.

Personally, I really like JavaScript. Well, OK. Function scope is completely retarded and there were a bunch of other bad decisions being made, but it’s lots of fun nonetheless. It doesn’t scale that well though. I wouldn’t want to work on a JS project with >5kloc.

I also think that Dart is kinda neat in theory. I just can’t see it succeed. I mean, even if Chrome would get >50%, it would look pretty bad for Dart. Chrome + Android + Chrome OS + server-sided Dart… maaaaybe. Still somewhat weak.

I once hated JS but now I actually like it when I finally learned about the “crappy” design patterns to simulate inheritance.
Just wanted to make an important contribution to this thread :wink:

I still think that the crux of the issue is the fact that you’re forced to use it whether you want to or not. I think I might have said in another thread it’s like telling everybody they’ve got to speak French from now on. It’s not that there’s anything wrong with French or that it’s a crap language - it’s the fact that I’m an English speaker.

Cas :slight_smile:

hmmmmm are you implying that French is a crap language? :wink:

[It’s not that there’s anything wrong with French] or [It’s not that it’s a crap language]

Did you know French can be pronounced using Java! You’ll just have to use substring on each word to remove a random number of letters at the end of each word. About 1-3 should be fine.
[/joke]
French for non-French people!

First, it is a hack, not a language feature.

Second, the very existence of it is evidence of crappiness of Javascript. Why go through such trouble if you can get it for free in other languages?

Third, no, it doesn’t look good.

Manual labor is not intelligence. We shouldn’t have to build something like this, it should be part of the language.

  1. Find a pool.
  2. Cool off.
  3. ???
  4. Profit for everyone at JGO!

But seriously, you can say what you want about Javascript, but it’s not really relevant or interesting here. I haven’t done any Javascript, but from what I’ve heard I don’t think I like it either. xD

Obvious troll is obvious, but I’m falling for it anyway. Your arguments make no sense. OO and functions are all just hacks, clearly we should program in assembly because, God forbid if we had to build something onto a language in order to make it usable.