Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What about:

- easy accessibility of higher order functions (AKA functions as a first class object from the get go)

- graceful inclusion/addition of concurrency-handling functionality despite the language being single threaded (this might be much more to do with the context javascript was to be used in)

I agree with your sentiments on the value of type systems and compile-time type checking, but so many languages are in the same boat as JS in this regard -- it even applies to a bunch of lisp dialects (CL does have the `declare` form), and not many could consider lisp a "bad" language.



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.

2. Concurrent execution has also been introduced in the 1960s (Dijkstra 1965), Ada and Erlang supported that behaviour since the 80s.

3. LISP has a type system and basically any LISP runtime will yell at you for comparing strings with numbers just like that. SBCL can do this check at compile time even.

Additionally LISP lets you add a type system on top using macros and other tricks (some going as far as implementing a Haskell-like typesystem in LISP).


> 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 supported that behaviour since the 80s.

My point was not that concurrent execution was somehow invented by javascript, that would be an asinine claim. My point was that javascript has done surprisingly well to introduce these concepts to it's users (perhaps out of necessity given the runtime environment it's in), whereas concurrent programming is considered an advanced concept in other languages and isn't taught till very late if not at all.

> 3. LISP has a type system and basically any LISP runtime will yell at you for comparing strings with numbers just like that. SBCL can do this check at compile time even.

this depends on the dialect of lisp you're using. SBCL will certainly do basic type checking and even advanced if you make use of `declare`. I'm not sure what I implied that would make you think I am crediting javascript with inventing type systems (?). I know lisp is great -- that's why I mentioned it as a language people highly regard, but is not compile-time typechecked depending on the dialect you're using, but people wouldn't say that makes it a bad lanaguage.

It's like you read my comment and decided that I said javascript was the best language ever invented. My point was that it's made some choices with some good outcomes. Java as a language consciously chose not to have first class functions for the longest time (1.1 to 1.8 IIRC), yet people from Java will continuously bash JS as being the worst language they've ever seen.


> 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 as npm packages?


> 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.


Go is good as better C replacement for all use cases still being written in C that could actually be done safely in a GC enabled language, as they aren't targeting stuff like 16KB PICs.

For anything else, we have seen the future.



> easy accessibility of higher order functions (AKA functions as a first class object from the get go)

C and Assembly are probably the only languages left where this isn't the case.

And even C has the blocks extension on Apple platforms, although I would take the "easy" part out of it given the lifetime semantics.


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://libcello.org/


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.


As mentioned "Also plenty of developers on the Java platform are polyglot.".

I never worked in a company of "Language X developer", rather developers that would use whatever language suited the project. Including mixing multiple languages on the same project if that would be the best approach.

In those 19 years, JavaScript was mostly used to make graphics jump all around the page and form validation, hardly something worthy of high order functions and currying.

Javascript, the language that was largely tolerated until a book called "JavaScript: The Good Parts" came out, in 2008.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: