Live data from Hacker News

For modern development Javascript indeed is a shit language

live.julik.nl

101–110 of 243 posts

Re: For modern development Javascript indeed is a shit language

#101
post #53
post #16

Earlier quoted context omitted.

If you're doing frontend dev, then you must use Javascript or a language which compiles to Javascript. I believe Dart currently has a mostly functional tool to compile Dart code to Javascript. As for callback hell, Dart has "Futures" which are basically Promises. If you like Promises, you could use Dart...or one of the many excellent Promise libraries for Javascript; the syntax is almost identical. (The linked articl…

The "syntax" of promises in JS and Dart isn't really a syntax. They are library features in the form of fluent method chaining. This is merely a library pattern, it is not a syntax. A syntax would be something like the async/await support in C#. Or the async and let!, do! etc along with pipelines in F#.

Are there any compile-to-JavaScript languages out there, which do this?

I read about function* and yield, but this seems to require all functions to be rewritten.

Also I don't quite understand how this accomplishes to run 2 functions in parallel, if they are async.

Re: For modern development Javascript indeed is a shit language

#102
post #17

Earlier quoted context omitted.

I see this all the time. JS is slow because of the dom. No. JS is slow because JS is slow. Yes, I know V8 makes it faster than it used to be. Yes I know it is neck and neck for computation, but because of the way memory is handled it is slow for loading large dictionaries. But I could forgive all of that. JavaScript is not well designed for work in a team environment, nor is it well designed for Large Code Bases. But…

>"JS is slow." In comparison to what? JS is one of the faster script languages out there. V8 is way faster that Ruby and outperform python a lot of time as well. It's regex is blast fast as well.

It outperforms Python at everything except where Python just calls a C function. Ruby (especially the recent releases) is on par with Python speed, if not faster. But neither is close to JS.

Re: For modern development Javascript indeed is a shit language

#103

Earlier quoted context omitted.

> [1,10,5,-15,-2,4].sort(function(a,b) {return a > b}) [ -15, -2, 1, 4, 5, 10 ] > [1,10,5,-15,-2,4].sort(function(a,b) {return ""+a > ""+b}) [ -15, -2, 1, 10, 4, 5 ] Perhaps .sort was initially designed to do something else, like sorting strings, rather than integers.

I'm pretty sure that the parent comment's author is aware of this. It does not change the fact that it's broken.

Not when I posted this, he's edited his comment.

Re: For modern development Javascript indeed is a shit language

#104
post #11

Sadly I agree, you can just start with this: > [1,10,5,-15,-2,4].sort(); [-15,-2,1,10,4,5] And yes saying "oh but it is because it has weak types" doesn't excuse it, it is broken and that's that. Naming the brokeness with a label or showing why historically it is there, doesn't fix it. On the other hand they do have nice closure support, I do like some of that. But in large, the language makes me angry every time I h…

     [1,10,5,-15,-2,4].sort (a, b) -> a-b
You're right; that was totally difficult.

Re: For modern development Javascript indeed is a shit language

#105
post #53
post #16

Earlier quoted context omitted.

If you're doing frontend dev, then you must use Javascript or a language which compiles to Javascript. I believe Dart currently has a mostly functional tool to compile Dart code to Javascript. As for callback hell, Dart has "Futures" which are basically Promises. If you like Promises, you could use Dart...or one of the many excellent Promise libraries for Javascript; the syntax is almost identical. (The linked articl…

The "syntax" of promises in JS and Dart isn't really a syntax. They are library features in the form of fluent method chaining. This is merely a library pattern, it is not a syntax. A syntax would be something like the async/await support in C#. Or the async and let!, do! etc along with pipelines in F#.

A valid point; that just seemed like the easiest way of phrasing it to me.

Anyhow, what I was trying to say is that the linked article trashes Promises, and Dart has Promises, so Dart is at least in that respect not a solution.

Re: For modern development Javascript indeed is a shit language

#106
post #58

I have always wondered why so many people like dynamically types languages... I mean, if I have a variable I ALWAYS know what kind of data I expect in it. If I try to use different kinds of data in the same variable then something is clearly wrong - either with me (for wanting that) or with the way I use the variable (and I would appreciate some warning about it). The problem is that you hardly have a choice nowadays…

The reason alot of people like dynamicly typed languages is that they don't have to babysit the compiler. Small example, in JS, if you have a function that works on a "age" property of an object, it doesn't matter what kind of object you send in, as long as it has an "age" property. You can do this easily in staticly typed languages as well, but you have to write more code (generics, class/struct-definitions, interfaces ...).

> I mean, if I have a variable I ALWAYS know what kind of data I expect in it

Really? Why did people invent generics/templates, interfaces and class-inheritance then? You won't always know what type you are receiving, and alot of the time you don't really care either, as long as it meets your criteria.

> The problem is that you hardly have a choice nowadays

Course you do: C/C++, Haskell, OCaml, Go, Nimrod... Soon you'll have Rust to play with as well.

>

Depends on your usecase. As long as your active memory use don't number in multiple GBs, GC is quite fast. I have an application spawning 1GB of garbage a second, this takes 5ms (a second) to collect. Not bad IMHO. The work they are doing on the new G1 collector also seems promising. Btw, GC can in many cases have lower overhead than ARC (Python also does ARC btw).

> strongly typed but still allows generic object pointer (id)

Last I checked, most of Obj-C prefers dynamic typing. NSArray and NSDictionary for instance, can contain any type. Regarding (id), most languages allows this. "Object" in Java/C#, void* in C/C++, interace{} in Go etc.

In the end, it doesn't really matter what language you use, as long as it gets the job done. If your language isn't available, you're mostly able to use another language anyway. Almost every language nowadays has a JS-compiler. There exists a Java Bytecode -> Native code compiler, same with C#.

Re: For modern development Javascript indeed is a shit language

#107
no threads... (WebWorkers to the rescue, still no threads)

counterintuitive variable scoping (poor new programmers that keep plaguing the web with bug after bug and shitty global riden code, until they eventually understand enclosures and functional scope), just so shitty.

can't really use all the language because it's broken in different places depending on the runtime (see "JavaScript the good parts" to learn the safe subset), it's like walking through a landmine coding in javascript, too many "don't's"

a=[]; //length is zero.

a[0]=1; //length is one.

a[23]=2; //length is two.

a.length //ask javascript for the length? outputs 24. SHITTY "LANGUAGE"

This is a language that has been stretched thin for a lot of things it wasn't meant to do.

Can we has script type="text/python", or script type="text/ruby", have some decent languages running on everybrowser once and for all, can't believe we're trying to rebuild everything that's already been matured in so many really powerful languages in this messy language. The fact that there are so many, so many frameworks for doing the same things, or that nobody knows for sure how to organize large amounts of code in a standard way show how weak this thing is.

can't wait for the javascript madness to end. in the meantime, until we don't decide to hack Chrome, and Firefox to include a virtual machine that can run the language of your choice we're stuck with this piece of shit.

Re: For modern development Javascript indeed is a shit language

#108
post #99
post #97

Earlier quoted context omitted.

....aaaaand scene. Cut!

I have literally no idea what you meant by this.

You didn't miss your cue, and delivered your lines perfectly. We're done for the day, we're not bringing in Eevee[1] and Dziuba[2] to shoot the "every language has warts hahaha what are you, a noob?" scene until tomorrow.

You did great, thanks again. Don't call us, we'll call you.

[1] http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...

[2] http://pages.citebite.com/b2x0j8q1megb

Re: For modern development Javascript indeed is a shit language

#109
post #65

Despite most of the points in this post being debatable — there's one bit that caught my eye: "Being nice will not help it, and CoffeeScript is not radical enough." As the guy who started CoffeeScript, I agree. It's an intentionally very conservative approach. But there's more than one good way to skin the JavaScript cat. I think it would be fun to take another run at the same problem — attempt to find a minimal, rea…

> I've been playing around with it a bit... Tell us more!

I'm afraid that there's not much to show yet, apart from some little prototype scribblings, and the basic idea:

The web that we build for today is a rich, almost entirely backwards-compatible stew of nearly two decades of browser development and standards work, resulting in a triumvirate of very different languages that need to come together in order to make a web application happen: HTML + CSS + JS. Two of them are weak, data-description languages, one is strong and general-purpose. You have to learn all three, and learn about the quirks and sunspots accumulated over the years.

So, as a thought experiment, imagine what it would be like to work with a single language that was general-purpose, but also excellent at describing data, especially the trees (HTML) and property lists (CSS) that make up web documents. Perhaps it knows about the intended lifecycle of your HTML in a more structured way. Perhaps other flatly descriptive parts of your application can be merged with the "flat" styling of your CSS descriptions. Perhaps the idea of "binding" is built-in.

After that, there's technical hoopla. If it's interpreted in the browser, you need to be light and parse quickly, you need to be able to "JIT" chunks of code into optimized JavaScript when necessary, and you need to be able to dynamically generate the appropriate source maps, so that it feels closer to a seamless experience.

Is such a unifying language possible? I don't know. But imagine how much more fun it might be to work with — and more importantly, how much more accessible it could be for folks just getting started.

But when there is something to show, y'all will be the first to know...

Re: For modern development Javascript indeed is a shit language

#110
Well, this will probably just be ignored or downvoted, but as far as I can tell, ToffeeScript (a derivative of CoffeeScript which is a derivative of JavaScript) is the best language to be programming in today.

Of course "best" is subjective, but I believe that the combination of Node.js's superior module system and the available packages, the clarity of the language (which actually surpasses Python) combined with the asynchronous single-threaded event-based model, and ToffeeScript syntax which makes asynchronous code read like synchronous code, makes this a superior platform.

I do think that Go is a wonderful evolution of C, but the module system or at least ecosystem is inferior to Node's, and the language syntax and concurrency approach (although very useful and better than Node's in many circumstances) is old-fashioned.

Many people don't trust, don't learn, and ultimately cannot objectively evaluate JavaScript, simply because it is too easy to use. [sarcasm] And everyone knows that real programmers don't use easy languages. Those are for beginners.[/sarcasm] That's the real explanation for most of the JS hate. The other part of it is the people who did try to learn it, found out there were problems, and then for whatever illogical reason decided that they couldn't use CoffeeScript or any other similar language to compensate for those problems.

Post reply on HN