Live data from Hacker News

For modern development Javascript indeed is a shit language

live.julik.nl

91–100 of 243 posts

Re: For modern development Javascript indeed is a shit language

#92

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.

I don't know - it's just a default general API, obviously it's not going to match everyone's use case. I would say that even relying on sort made by someone else is already not fit for many use cases.

If such a petty and trivial "problem" is what you have against Javascript, then you are basically saying it's a good language :--)

Re: For modern development Javascript indeed is a shit language

#93
post #78
post #67

Earlier quoted context omitted.

In JS, sending the "wrong" number of arguments is frequently a feature. There's no concept of language-level function overloading, and it allows for the authorship of functions that take a variable or unbounded number of arguments (useful when coding in a functional paradigm).

That "feature" would be better with an explicit language construct such as *args or params args[], though. As with so many complaints about JavaScript, it's the default behaviour that is a problem.

ES6 brings "rest parameter" [0].

function(param1, param2, ...rest) {}

[0] http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html

Re: For modern development Javascript indeed is a shit language

#94
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…

The sort function is fine when used as intended (for alphabetic sorting). If you want numeric sorting you use sort(function(a,b){return a-b}).

[1,10,5,-15,-2,4].sort(function(a,b){return a-b}); [-15, -2, 1, 4, 5, 10]

Re: For modern development Javascript indeed is a shit language

#95
post #36

Earlier quoted context omitted.

>Obviously Node (and JS) has some things that it is strong in. People use it to build those things. Good developers won't use a tool in their box which is inferior to another tool they can use effectively. In between, there is a lot of room for "good enough" where tools overlap. People use JavaScript not because it's good but because it's the only option to develop in a browser. Having the same language on the client…

> Having the same language on the client and the server is a very strong point Only if you're so incredibly strapped for cash that you can't hire real devs that can pick up another language in a day or two. Almost every language used commonly on the serverside is vastly preferable to js. This whole "well, it's THE SAME" benefit simply isn't. It's a red herring. I'm convinced the whole ecosystem has sprung up because…

> Anyone not stupid or insane just learns ruby or python or scala or go or even php or .NET.

I started with PHP and C#/VB.NET, before learning JS. I know Python, Scheme, Java, I've played a bit with Clojure and Ruby[0]. After all that, JavaScript (admittedly, usually through CoffeeScript) is my favorite language. It provides everything you need to build almost anything you want, wrt tooling.

I understand and agree that it has warts, as does every language. But to call its use "stupid or insane" is ridiculous.

[0] I have yet to understand the concept of blocks, as they seem to be just a half-assed implementation of first-class anonymous functions. If someone can show how they improve on them, that would be much appreciated.

Re: For modern development Javascript indeed is a shit language

#96

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.

It's not broken.

Re: For modern development Javascript indeed is a shit language

#97
post #95
post #36

Earlier quoted context omitted.

> Having the same language on the client and the server is a very strong point Only if you're so incredibly strapped for cash that you can't hire real devs that can pick up another language in a day or two. Almost every language used commonly on the serverside is vastly preferable to js. This whole "well, it's THE SAME" benefit simply isn't. It's a red herring. I'm convinced the whole ecosystem has sprung up because…

> Anyone not stupid or insane just learns ruby or python or scala or go or even php or .NET. I started with PHP and C#/VB.NET, before learning JS. I know Python, Scheme, Java, I've played a bit with Clojure and Ruby[0]. After all that, JavaScript (admittedly, usually through CoffeeScript) is my favorite language. It provides everything you need to build almost anything you want, wrt tooling. I understand and agree th…

....aaaaand scene. Cut!

Re: For modern development Javascript indeed is a shit language

#98
> In a normal situation this would have been fixed simply by adding a wait primitive to the language which would schedule the events when the result is still being fetched... 80 percent of the programming is about doing one motherfucking thing with another motherfucking thing and you need both of them to complete the action.

I love JavaScript, but I totally agree with this.

Re: For modern development Javascript indeed is a shit language

#99
post #97
post #95

Earlier quoted context omitted.

> Anyone not stupid or insane just learns ruby or python or scala or go or even php or .NET. I started with PHP and C#/VB.NET, before learning JS. I know Python, Scheme, Java, I've played a bit with Clojure and Ruby[0]. After all that, JavaScript (admittedly, usually through CoffeeScript) is my favorite language. It provides everything you need to build almost anything you want, wrt tooling. I understand and agree th…

....aaaaand scene. Cut!

I have literally no idea what you meant by this.
Post reply on HN