Live data from Hacker News

JavaScript is Good, Actually

ashfurrow.com

341–350 of 369 posts

Re: JavaScript is Good, Actually

#341
post #329

Earlier quoted context omitted.

And if every Python developer, researcher using Python, etc, did that, it would be much less of a problem. The reality is, many, many don't. It's kind of ironic, really. With the Zen of Python stating "There should be one-- and preferably only one --obvious way to do it" why is it that it's so common for people to not do the thing that makes it reasonably portable? I mean, I currently am working with some code that,…

> Is the author not a Python developer? Well, he's a researcher. I think this is why the situation is bad in Python: we have too many non-programmers in the community, that simply want something to work and get on with theirs life. If they can get by it by installing a bunch of libraries by running some command incantations as root, they're happy enough. You don't have this problem with Node because the only niche th…

> we have too many non-programmers in the community, that simply want something to work and get on with theirs life

The impact of those people in the ecosystem is zero, though. They don't inconvenience anyone by producing badly-written libraries, they literally do their job, produce what they want to produce and everyone is happy. I'm not sure why they get lumped in with "this problem".

I don't know why I hear this a lot, it certainly doesn't echo my experience. I've rarely had dependency problems, even the regular requirements.txt (without pinning to specific versions) tends to work well enough on reasonably current code. Pipenv pretty much solves the problem by introducing a lockfile.

Re: JavaScript is Good, Actually

#342

Earlier quoted context omitted.

> It's not a great language (clearly demonstrated by the discussion about it being good or not) but it's not terrible I'm wondering what would be an example of a great language? Because we know that there are only two kinds of languages: the ones people complain about and the ones nobody uses

My response to this is usually that Ruby is a great language because it's easy to get useful work done with a large, meaningful subset of the language. You can ignore the warts just by not using them. You can't do that in JS, because the warts are so fundamental. (yes, you can be tripped up by library authors in Ruby, but there's community backpressure against providing footguns).

[deleted]

Re: JavaScript is Good, Actually

#343
post #223

Code spends most of its time being in production and not in development. During that time in production, developers will leave the team, bugs will show up, major enhancements will be made. So it is important that the codebase is easy to reason about, easy to refactor and easy to debug. If you take a language like Java and an IDE like Eclipse or Intellij IDEA, it is trivial to find from where a particular piece of cod…

The tooling makes up for it -- VSCode, for example. Click to definition, right out of the box. The number of options is too numerous to be listed here. Modern Javascript is as much about the tools as it is about the language, as the writer points out.

Re: JavaScript is Good, Actually

#344
post #50

I'm an outsider to the JS world but find it absolutely fascinating the direction the language has taken. It's clear that a lot of the new language features enable more concise functional programming. I see this as a good thing. I'm really surprised that whilst the language on the one hand gives nice tools like the object spread syntax, the last time I checked it didn't make it easy to make the interpreter enforce imm…

Again, tooling: https://github.com/jhusain/eslint-plugin-immutable

Re: JavaScript is Good, Actually

#345
post #122

Earlier quoted context omitted.

This wasn't true in Java until 1.8 and the addition of Functional interfaces though. I wasn't trying to name any languages in particular but that was one. I've seen java developers struggle with the concept of futures/promises while for web developers it was covered in Javascript 102 and they've been using them day in and day out for years. This was the benefit i meant. Also, I wonder if anyone actually uses http://l…

We are in 2018, Java 8 was released in 2014. Before we used anonymous classes for the same effect. Also plenty of developers on the Java platform are polyglot.

Java was released in 1995, we're going to just ignore ~19 years of a consistent bad decision to make ergonomics worse for people who use the language?

To be fair, good alternatives also haven't really existed for a long time either -- alternative languages on the JVM weren't popular, Golang and Rust didn't exist, C# required changing to a MS shop, ObjC was ObjC... But I'm not going to sit here and forget about a bad decision persisted for 19 years just because they fixed it 4 years ago. In that very specific case, Javascript did the right thing, from the beginning, and deserves to be praised for that individually.

Re: JavaScript is Good, Actually

#346

Earlier quoted context omitted.

> And you can't do something like this in a clean way: That's what nonlocal is for: https://docs.python.org/3/reference/simple_stmts.html#the-no... Just stick "nonlocal counter" in your function and it works.

True. But nonlocal is relatively new. Also nonlocal implies that other variables are local, which is not true. E.g., the following works without "nonlocal" keyword: counter = [0] def add(n): counter[0] += n add(1) add(2) (This used to be my workaround.)

nonlocal implies that you are reassigning a variable outside of the local scope.

Your example works because you are mutating an existing object, not reassigning a new one.

It's a disingenuous comparison IMO.

Re: JavaScript is Good, Actually

#347
post #126

Earlier quoted context omitted.

> 1. We've had higher order functions since 1960s, it's not a new discovery that is singular to JS, that award goes to LISP and Scheme. My point wasn't that javascript invented higher order functions, it was that making them first class isn't something all languages have chosen to do, and is clearly a good choice. > 2. Concurrent execution has also been introduced in the 1960s (Dijkstra 1965), Ada and Erlang supporte…

> people from Java Java will continuously bash JS as being the worst language they've ever seen. Rightfully so. What positive things can we say about a programming language where this is valid code? [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!!) Just a snippet, more fun can be had at http://www.jsfuck.com/ Or the community tradition of writing one liners…

> What positive things can we say about a programming language where this is valid code?

Just because it parses doesn't mean anyone would ever write it in a serious project.

Also, I've seen worse in Java (AbstractSingletonProxyFactoryBean), the only difference being that someone wrote the code with good intentions -- not as a joke. "Idiomatic" Java code is often bloated, and people who write it have been trained to defend the bloat until their dying breath.

> Or the community tradition of writing one liners as npm packages?

I'd pick npm over the hellscape that is maven +/- gradle and managing the class path anyday.

I honestly think in about 5~10 years, something like Golang is going to be more common at most forward thinking companies than Java, with or without generics.

Re: JavaScript is Good, Actually

#348

Earlier quoted context omitted.

Why not use node so you can avoid the browser and the extension?

Because there is usually a need to input data or parameters and I prefer a GUI textbox more than file based or command based approach. I also prefer visual inspection and debugging. Browsers make all this simpler.

Consider bootstrapping a simple Electron instance. You get the whole browser, but you get the great node stuff too.

https://electronjs.org/

Re: JavaScript is Good, Actually

#349
post #52

Earlier quoted context omitted.

An advantage, however, is that you can directly encode Javascript data objects to JSON without having to annotate its fields or anything. I don't recall you being able to do that with Java.

You can't do that with javascript either unless your data objects are acyclic and if they are then using a JSON parser for Java is equally trivial.

You mean that if they are acyclic, you don't have to annotate the fields in Java either? Because the data objects I want to serialize usually are acyclic.

Re: JavaScript is Good, Actually

#350
post #328
post #307

Earlier quoted context omitted.

A plan that is already in motion regardless how much you hate it. Not all languages are like Python, a language that I only use for shell scripts anyway. Blazor, Qt, Unity are all getting there. Adobe can even bring Flash back.

I love the idea of wasm allowing other languages, but it's going to take at least a decade to be usable for anything aside from heavy number crunching with C++. For a webpage, replacing the DOM with UI toolkit X is a pipe dream with problems ranging from aria/accessibility to web crawling and indexing issues. Adobe won't be bringing flash back. It was basically just ES4. ESnext and HTML5 have almost all the good stuf…

Thankfully Microsoft thinks otherwise.

https://blogs.msdn.microsoft.com/webdev/2018/05/02/blazor-0-...

https://channel9.msdn.com/Events/Build/2018/BRK2151

Post reply on HN