Live data from Hacker News

For modern development Javascript indeed is a shit language

live.julik.nl

111–120 of 243 posts

Re: For modern development Javascript indeed is a shit language

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

I have always wondered why so many people like dynamically types languages

Because you don't have to write a lot of boilerplate to tell the language things that it should be able to figure out for itself.

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

But that data might not always be of the same type. For example, in Python, I might want a variable to hold strings but also None, so that I can differentiate between, say, "the user explicitly entered an empty string" and "the user hasn't entered any string at all yet".

Yes, there are ways to do this in statically typed languages (for example, Haskell's Maybe), but it's still extra code that I have to write.

Re: For modern development Javascript indeed is a shit language

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

It's good to have dynamic typing as an optional feature in a language (e.g. how it is implemented in C#). It could be useful for some very specific scenarios - typically around integration of different systems. But I agree that it doesn't make much sense to use them all the time. I think people mean that they like decent type inference when they say they like dynamic languages. C# makes a distinction between 'var' and 'dynamic' to make it more clear.

Re: For modern development Javascript indeed is a shit language

#113
post #77
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 only picked up steam because Flash died. Not because it was a great language. If it were a great language people would have started optimizing it 5 years ago. It isn't. So they didn't. The new optimizations are out of necessity. And because it lets front end pretend to be backend. That may sound snobby, and it is, but JS for backend is like writing in Visual Basic. These days you can do anything in it, it will…

I wanted to switch to other languages rather often, but most of them are getting strange quite early in the learning process.

Re: For modern development Javascript indeed is a shit language

#114

Earlier quoted context omitted.

CoffeeScript was obviously inspired by Ruby. While CS is great, I've never gotten over the usage of "->" or "=>" to signify a function. To me, Ruby's "def" or "do" reads so much better. Especially with "end", to signify a barrier, as opposed to whitespace. Have you considered porting Ruby directly to JavaScript? By the way, thanks for your work on _ & Backbone!

> Have you considered porting Ruby directly to JavaScript? No. It's been attempted before, and it doesn't turn out to be terribly useful in the end, because of the vast semantic mismatch between the two languages. See: https://github.com/jashkenas/coffee-script/wiki/List-of-lang... > I've never gotten over the usage of "->" or "=>" to signify a function. Give it a try, perhaps. It's critical not to use "def" and "do"…

>> it doesn't turn out to be terribly useful in the end

True, I'd chose CoffeeScript over Opal.

>> Give it a try, perhaps.

Oh, I dig it, especially the fat arrow.

>> It's critical not to use "def" and "do" when your functions are first-class values that can be passed as arguments, or assigned to variables.

Still, I find "def" to be more `readable` than arrow symbols. I'm not sure how JavaScript's first class status for functions would deter a keyword containing letters. Considering JavaScript itself uses function as its.

>> The reason it's an arrow is because in any decent function, the input determines the output, eg. input points to output. And therefore, the CoffeeScript syntax: (input) -> output

That definitely makes logical sense. Still, I feel the readability might be increased by using words, which the mind is more attuned to quickly applying meaning to.

Edit: Great job, on CoffeeScript, regardless!

Re: For modern development Javascript indeed is a shit language

#115

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 have no idea why, but CoffeeScript gives me a "kid on Christmas" feeling when I code in it. I never realized how much mental load went into counting braces and curly brackets, how many times I've tried randomly copy-pasting a variable assignment into different parts of a script until I stopped getting an error, etc. This weekend, I decided to pick up Node, and, to kill 2 birds with one stone, I've been rewriting every tutorial I've used as CoffeeScript just to test myself.

I've tried to think about potential improvements to CoffeeScript, but I have to say that I'm completely satisfied with the language now. Many of the things that I think would sweeten the language even more are easily achieved by simply including 3rd party JavaScript libraries.

Thank you so much for contributing 3 great pieces of work to the community!

Re: For modern development Javascript indeed is a shit language

#116
post #7

Earlier quoted context omitted.

How do you handle Javascript ignoring wrong numbers of function arguments? Do you use a linter to catch this sort of thing? This part of Javascript sounds the most absolutely insane to me: Silencing an error like that is catastrophic.

Silencing an error like that is catastrophic. Silencing an error would be a problem, but in JS, it's not an error , because there's no concept of "wrong numbers of function arguments" built into the language. That's not to say you can't inspect the number of arguments yourself and throw an error, if some situation warrants it. But you don't have to do this. It's a very flexible, dynamic language. In some ways this fl…

> ... in other ways it necessitates more manual checking (or slower debugging). There's no catastrophe, just design differences.

See, there's the problem. Glossing over issues by explaining them away as "design differences". Nothing about an expressive language necessitates making life hard for the programmer. If your function call doesn't match the signature then it is very likely to be in error, and instead of failing silently the language should make such mistakes easy to spot. I like how most other dynamic languages require you to be more explicit about function parameters (with the exception of PHP).

Re: For modern development Javascript indeed is a shit language

#117
post #105
post #53

Earlier quoted context omitted.

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.

And this aspect is one of the biggest problems I got with JavaScript.

The only big things, which Dart seems to solve, is modularization and the many tiny JavaScript quirks, for which IDEs or a strong understanding of the language is needed.

Re: For modern development Javascript indeed is a shit language

#118

> They are not solvable by making a new ECMA spec. As it turns out, many of the issues outlined are not only very much solvable by making a new ECMA spec but either already solved in ES5 or solved in ES6. > JS has callable attributes > This is a shitty design decision I strongly recommend not following the provided link, which is basically inane, uses the term "slots" in a rather disturbing manner and makes completel…

ES6 has not been finished yet as far as I know.

Re: For modern development Javascript indeed is a shit language

#119

> They are not solvable by making a new ECMA spec. As it turns out, many of the issues outlined are not only very much solvable by making a new ECMA spec but either already solved in ES5 or solved in ES6. > JS has callable attributes > This is a shitty design decision I strongly recommend not following the provided link, which is basically inane, uses the term "slots" in a rather disturbing manner and makes completel…

> All runtimes but MSIE (unless they've added it in IE11) already implement `const`, and it's standardized in ES6.

const implemented currently is very weird thing. It's more or less a read only variable, which silently ignores updates

var i = 0; for (var j = 0; j This is not something one would expect of constants honestly.

> You mean, something like ES6's yield?

yield is shallow, caller must be ready to cope with yielding explicitly, so it's not really a good replacement to proper coroutines that can pause arbitrary deep stacks.

Re: For modern development Javascript indeed is a shit language

#120
post #41

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…

It depends on what you are building. Server side can cover so much ground these days. It could be the Ghost blogging app which was recently released or we could be talking about the muscle behind Google. Node covers a lot of "good enough" space for what a lot of people are doing. The people who complain the loudest about Node are likely those who are working on things which aren't covered by that "good enough" circle…

The majority of people writing Node code don't know what that "good enough" space covers. Or they get so excited hitting something with that hammer that they stop looking in the toolbox.

Node is fantastic for rapid prototype development, or tiny little startups that need to do the absolute minimum amount of work so they can finish before running out of money.

Everything goes sideways when these cute little Node apps get pushed out to real production use (if you measure things in anything other than dollars per second, you don't get to chime in here and redefine production). Then the heavy hitters have to come in and patch Node itself, or rewrite it in another language.

I've gone in to a growing startup over a weekend and saved them $1000/mo in AWS instances by rewriting a Node app in 30 lines of Go.

I hate to cite examples of real world projects in threads like this, because it just devolves into "OMG YOU NOOB THAT WAS FIXED IN THE BASHFUL BADGER RELEASE" when said fix was the result of a bug you opened or a patch you submitted.

Post reply on HN