News for hackers. Stuff that matters.
Re:James Webb Telescope will run a proprietary JS interprete... by joekrill on Wednesday April 24, 2019 @09:43AM (#19738205)
So what exactly makes a "proper programming language"?
Re:James Webb Telescope will run a proprietary JS interprete... by redleggedfrog on Wednesday April 24, 2019 @10:08AM (#19738462)
I could see how that would be considered inflammatory, but it was not intended that way.

I have a somewhat fuzzy definition. "A programming language that has more 'intent' to it."

For example, Rust. The designers had definite ideas about what they were creating, noted the trade-offs, and implemented features based on those decisions.

You can say that about lots of languages - Java, C#, Swift, or if you need to go back 10 years, Java <g />, C, or maybe even Python.

JavaScript on the other hand was cobbled together in a few weeks by some poor fellow who was under impossible deadlines. And it shows. We've all seen the "Wat" video. Programming in JavaScript is a minefield of bizarre phenomena. Function scopes as namespaces. Nutty math. It succeeds in spite of itself because, a. It's rarely used for anything truly important, and b. It runs on the most popular run-time environment on the planet.

Not that you can't do great things with JavaScript. But just about any other language would have been preferable.

Re:James Webb Telescope will run a proprietary JS interprete... by kowdermeister on Wednesday April 24, 2019 @11:48AM (#19739593)
The wat talk is really funny, but it proves only that if you do moronic things, you will get nonsense results. Truly shocking.

> cobbled together in a few weeks by some poor fellow

It was. And then all work has stopped on it, right?

Re:James Webb Telescope will run a proprietary JS interprete... by redleggedfrog on Wednesday April 24, 2019 @12:26PM (#19740022)
No, but that's it's Achilles heel. You can't really just the fundamental part of the language because a gajillion websites are already in existence using it. We're stuck with the janky.
Re:James Webb Telescope will run a proprietary JS interprete... by kowdermeister on Wednesday April 24, 2019 @12:43PM (#19740198)
Are the fundamentals really janky?

Prototypical inheritance is actually not a bad choice.

The event loop also stood the stand the test of time, it's a great choice for IO heavy environments like the web is.

The weak type system made it possible to bang out code really quickly without much thought thus making it very beginner friendly. Most of its issues can be traced back to this.

Re:James Webb Telescope will run a proprietary JS interprete... by blueline on Wednesday April 24, 2019 @11:51AM (#19739614)
>For example, Rust

every time like clockwork

Re:James Webb Telescope will run a proprietary JS interprete... by moron4hire on Wednesday April 24, 2019 @10:24AM (#19738604)
Most of the "wat" video's complaints also apply to Python. And JavaScript has had many more years of considered design and development than when JQuery or Node made it popular.
Re:James Webb Telescope will run a proprietary JS interprete... by deathanatos on Wednesday April 24, 2019 @11:09AM (#19739132)
> Most of the "wat" video's complaints also apply to Python.

No, they don't. All of Wat's complaints against JS, in order of presentation:

> [] + [] ; JS: '', Python: []

Python uses + between arrays for concatenation, just like strings, which I think is reasonable. JavaScript does random crap.

> [] + {} ; JS: '[object Object]' (that's a string, not an object), Python: TypeError.

Again, Python's output here is reasonable, JS's is off the deep-end.

> {} + [] ; JS: 0 (the integer) Python: TypeError

Again, Python's output here is reasonable. JS appears to demonstrate that + isn't commutative, but that's too rosy a picture: in this case, + actually is commutative, as ({} + []) and ([] + {}) are the same string, but without the parentheses we get 0. Yes, the lack of parentheses changes the value JS emits.¹

> {} + {} ; in Wat: NaN, in Chrome/Node: '[object Object][object Object]', in Python: TypeError

Similar to before, Python errors out on the garbage, JS just keep computing ever more insane values.

> [longer example, but boils down to "wat"+1 doing something and "wat"-1 doing something else for comedic effect.

Python TypeErrors on both of these.

Python certainly has its own warts, but they are not as ridiculous as the warts that JS carries around.

¹AIUI, {} + [] is parsed as empty code block, implicit semicolon, unary plus, empty array. The parentheses force the grammar to evaluate the entire thing as an expression, so ({} + []) parses instead as a parenthesized empty object, binary plus, empty array.

Re:James Webb Telescope will run a proprietary JS interprete... by technion on Wednesday April 24, 2019 @08:32PM (#19743877)
Purely for reference (since typescript didn't exist when this project started) all four of those terrible JS examples are Typescript errors: " error TS2365: Operator '+' cannot be applied to types x and y"
Re:James Webb Telescope will run a proprietary JS interprete... by londt8 on Wednesday April 24, 2019 @11:02AM (#19739024)
You are thinking of something else than python? Python has strong, dynamic type system with little implicit type conversions.
Re:James Webb Telescope will run a proprietary JS interprete... by orf on Wednesday April 24, 2019 @10:50AM (#19738883)
They really don't.
Re:James Webb Telescope will run a proprietary JS interprete... by bobcostas55 on Wednesday April 24, 2019 @10:50AM (#19738880)
It's one where empty array plus empty array does _not_ equal an empty string.
Re:James Webb Telescope will run a proprietary JS interprete... by apta on Wednesday April 24, 2019 @09:46AM (#19738234)
Not JavaScript
Re:James Webb Telescope will run a proprietary JS interprete... by Avshalom on Wednesday April 24, 2019 @11:07AM (#19739105)
integers.
Re:James Webb Telescope will run a proprietary JS interprete... by maxerickson on Wednesday April 24, 2019 @11:26AM (#19739316)
Cashew nuts!
Re:James Webb Telescope will run a proprietary JS interprete... by NotAnEconomist on Wednesday April 24, 2019 @09:47AM (#19738253)
Having written in it for a while, JavaScript just kind of is "meh".

TypeScript, for instance, is a much better development experience in terms of language constructs, but that only makes the package management situation stand out more.

Re:James Webb Telescope will run a proprietary JS interprete... by amluto on Wednesday April 24, 2019 @09:46AM (#19738239)
In the context of a critical, long-running, resource-constrained system, a language + runtime that can have deterministic memory usage. So: not JavaScript and probably not J2SE either.