News for hackers. Stuff that matters.
Re:Office 365 is being completely rewritten in JavaScript by nawgszy on Wednesday June 13, 2018 @05:49AM (#17301661)
>it's just not a terribly good or fast one

From everything I've seen, its performance sits just below Java (4x slower, perhaps) on some standard algorithms or tasks, and significantly faster than languages like Ruby, Python, etc.. I never see hate for those languages like for JS, so I'll disregard that.

>not terribly good

This one never has made sense. What is it missing that makes you hate it so? I think it has rather robust asynchronous handling, 'everything is an object' has lots of nice implications when paired with functionality like Object.keys / .assign, ... So what are the issues you see that make it 'bad'?

Re:Office 365 is being completely rewritten in JavaScript by arghwhat on Wednesday June 13, 2018 @06:02AM (#17301720)
> (4x slower, perhaps)

"4x" is a lot slower, and a lot of things are much worse than this. You have to have deep knowledge of the VM (such as knowing how "hidden classes" work in V8) to be able to get JS close to Java.

> so I'll disregard that.

You shouldn't. Claiming a JIT'ed language is fast due to being faster than Python, an entirely interpreted language, is like saying a moped is a fast vehicle because it's faster than biking. Apples and oranges.

Being faster than PyPy, the JIT'ed Python implementation, is a more interesting thing, but this is still very far off "fast" languages.

> What is it missing that makes you hate it so?

Most language features, really. "Everything is an object and objects are hashmaps, EVEN ARRAYS" (terrible for performance, type safety), "array of int16" strings with totally broken unicode codepoint handling (ES2016 brought new ways to deal with codepoints, but the standard way is still broken), the "Number" type which is totally retarted, the terrible "prototype" system, the malice that is "this" and how any bare function expression had its own this context (arrow functions are a good workaround now), and god I could go on.

"Everything is an object" is only useful if you either actually need a hashmap (then use one!), or you have sloppy types.

JS, as a langauge, is not well designed. I'm not saying it had to be Haskell or Rust, but JS is far below average.

It works, and does it job decently due to the very hard work of JS engine implementors trying to make this crazy thing fast, but that's not the same as being good.

Re:Office 365 is being completely rewritten in JavaScript by jhall1468 on Wednesday June 13, 2018 @09:39AM (#17302901)
> 4x" is a lot slower, and a lot of things are much worse than this. You have to have deep knowledge of the VM (such as knowing how "hidden classes" work in V8) to be able to get JS close to Java.

That's a solid argument for only programming in C and Assembly because they are often 4x faster than anything.

> Most language features, really.

AKA, your preferences are "language features".

> Everything is an object

So you don't like Python. Or Ruby.

> the "Number" type which is totally retarted

Very technical argument there.

> the terrible "prototype" system

So you prefer classical inheritance. Cool. Doesn't mean prototypal inheritance is a bad thing.

None of what you mentioned are missing features, they are personal preferences stemming for your own language preference that differs dramatically from Javascript. I'd start by disassociating your opinionated stances from actual weaknesses in the language, of which there are many, and none of them are what you mentioned.

Re:Office 365 is being completely rewritten in JavaScript by bitL on Wednesday June 13, 2018 @06:21AM (#17301803)
> objects are hashmaps

But you still have to compute hashcode yourself :D

Re:Office 365 is being completely rewritten in JavaScript by xamuel on Wednesday June 13, 2018 @09:10AM (#17302676)
>Most language features, really.

Name a few.

>terrible "prototype" system

>malice that is "this"

It sounds like you are talking about ES5, not ES6+

Re:Office 365 is being completely rewritten in JavaScript by bitL on Wednesday June 13, 2018 @09:24AM (#17302785)
Can you guarantee all ES6- code to disappear immediately? Or are you forced to dive deep into warts when you have to work on some older JS project?
Re:Office 365 is being completely rewritten in JavaScript by jhall1468 on Wednesday June 13, 2018 @09:40AM (#17302912)
Wow, now we're complaining about the outdated versions of a language? Come on man. Nobody is going to write a modern application in ES5 and there are plenty of warts in old Java, C and Python applications as well. That's the nature of them being "old".
Re:Office 365 is being completely rewritten in JavaScript by shawnz on Wednesday June 13, 2018 @01:23PM (#17305168)
Why does that impact whether or not it's a reasonable choice to use the language today? Old libraries I could understand, but old independent projects? How do they affect the current state of the language?
Re:Office 365 is being completely rewritten in JavaScript by bitL on Wednesday June 13, 2018 @03:14PM (#17306113)
Isn't it obvious? You apply for a job, company that isn't a startup has code that is likely written with old JavaScript whose replacement is not economical, so even if you do everything new in ES7, you still have to wade through old ugly code, likely everyday.
Re:Office 365 is being completely rewritten in JavaScript by StavrosK on Wednesday June 13, 2018 @09:30AM (#17302823)
> Name a few.

He did, literally exactly after that sentence.

Re:Office 365 is being completely rewritten in JavaScript by xamuel on Wednesday June 13, 2018 @09:40AM (#17302913)
No, he listed some things that he thinks are broken, he didn't list missing language features
Re:Office 365 is being completely rewritten in JavaScript by StavrosK on Wednesday June 13, 2018 @09:46AM (#17302967)
I read it that he meant "fixes for these things are missing and that makes me hate it", i.e. I read it as the answer to your question. He doesn't hate it because it lacks features, he hates it because the existing features are badly implemented/thought-out.
Re:Office 365 is being completely rewritten in JavaScript by FridgeSeal on Wednesday June 13, 2018 @06:18AM (#17301788)
If I threw billions of dollars of vested interest at Python/Ruby/COBOL/(insert language of your choice) we can probably make those run at JS speeds as well. Does that solve the fundamental drawbacks of the languages?

Nope. No it does not.

JavaScript is particularly egregious because of it's weird behaviour about types and coercion and you know, just silently failing, behaviour that I wouldn't want going on in any proper system that handles anything important. Other people have written at great length about JS's many failings.

JS is not the only language with nice async support, practically every mature language has async support and a good number of the compiled ones have proper parallel support as well.

Re:Office 365 is being completely rewritten in JavaScript by cmiles74 on Wednesday June 13, 2018 @09:41AM (#17302920)
I think this is a really important point. Every browser vendor has spent huge amounts of dollars to increase the performance of Javascript. I don't know if there's another language that has enjoyed this level of investment... Maybe Java is closest, there are multiple companies working on their own VM implementations.

The reason so much has been spent on Javascript: it runs in the web browser. For sure, people have found other reasons to like Javascript but at the bottom of the pile, money was spent because it was in the browser and the browser vendors wanted the browser to do more.

Re:Office 365 is being completely rewritten in JavaScript by workinthehead on Wednesday June 13, 2018 @08:55AM (#17302568)
every dynamically-typed language has "weird" behaviour around type coercion, that's simply the nature of the beast.

sure wish i knew what you are talking about w/r/t "silently failing". JS has working exceptions just like 99% of widely used languages.

I'm very glad that you've been omniscient enough to determine what "proper" parallel support is, though. How's that working out for you? Meanwhile, those of us using JavaScript simply run one process per core and never worry about contention, deadlocks, or race conditions.

Re:Office 365 is being completely rewritten in JavaScript by pdpi on Wednesday June 13, 2018 @09:24AM (#17302782)
> every dynamically-typed language has "weird" behaviour around type coercion

Do they now?

    $ irb
    irb(main):001:0> "0" + 1
    TypeError: no implicit conversion of Fixnum into String
            from (irb):1:in `+'
            from (irb):1
            from /usr/bin/irb:11:in `<main>'
    irb(main):002:0> ^D
    $ python
    >>> "0" + 1
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: cannot concatenate 'str' and 'int' objects
    >>> ^D
    $ node
    > "0" + 1
    '01'
> Meanwhile, those of us using JavaScript simply run one process per core and never worry about contention, deadlocks, or race conditions.

If you never worry about those things, then you're either not sharing any resources at all (in which case threads are also dead easy), or you're failing to deal with the shared resources properly.

Re:Office 365 is being completely rewritten in JavaScript by StavrosK on Wednesday June 13, 2018 @09:36AM (#17302879)
I know you know this, but for the GP or anyone else: "Dynamically typed" doesn't mean "strongly typed". Python and Ruby are strongly typed, JS is weakly typed.
Re:Office 365 is being completely rewritten in JavaScript by pdpi on Wednesday June 13, 2018 @01:11PM (#17305042)
Yeah, went for the "picture is worth a thousand words" approach to explaining the distinction :)
Re:Office 365 is being completely rewritten in JavaScript by workinthehead on Wednesday June 13, 2018 @02:15PM (#17305667)
and yet you still managed to misunderstand the point :)
Re:Office 365 is being completely rewritten in JavaScript by workinthehead on Wednesday June 13, 2018 @10:17AM (#17303254)
Thank you for illustrating my point. All of the dynamic languages made different decisions on how to handle type conflicts, there simply is no right or wrong answer.

Oh, and JavaScript is single-threaded. It's impossible to share resources in a single process.

Re:Office 365 is being completely rewritten in JavaScript by pdpi on Wednesday June 13, 2018 @10:33AM (#17303422)
> Oh, and JavaScript is single-threaded. It's impossible to share resources in a single process.

DBs, files, etc etc. in-process memory isn't the only resource you're sharing.

Re:Office 365 is being completely rewritten in JavaScript by dragonwriter on Wednesday June 13, 2018 @09:50AM (#17303009)
> every dynamically-typed language has "weird" behaviour around type coercion, that's simply the nature of the beast.

No, that's not true at all. Dynamic languages don't necessarily have type coercion at all, much less weird behavior around it (and, conversely, statically typed languages they have coercion may have weird behavior around it; there's just no link between dynamic typing and weird coercion behavior.)

Re:Office 365 is being completely rewritten in JavaScript by workinthehead on Wednesday June 13, 2018 @10:19AM (#17303273)
Who's to say not doing type coercion isn't weird? Every dynamic language treats things slightly differently.
Re:Office 365 is being completely rewritten in JavaScript by dragonwriter on Wednesday June 13, 2018 @04:35PM (#17306697)
> Who's to say not doing type coercion isn't weird?

Well, if someone has to do it, I will: not doing type coercion isn't weird, and doing inplicit type coercion (not strict promotion[0]) is both weird and dangerous.

But, in any cases that's not really the point. The point is that in this...

> Every dynamic language treats things slightly differently.

“dynamic” is irrelevant. Languages have a wide variety of approaches, doing promotion, coercion, neither, or both (though where both are done, it's often just called coercion even when it is promotion), and dynamic vs. static is mostly irrelevant.

[0] that is, where the “from" type has a range that is a subset of the range of the “to” type.so that there is never a change in meaning resulting from the conversion.

Re:Office 365 is being completely rewritten in JavaScript by tom_ on Wednesday June 13, 2018 @09:03AM (#17302627)
Probably this thing, easy to spot in isolation but much harder when part of a larger system:

   > x={}
   > x.fred
   undefined
Actively unhelpful!
Re:Office 365 is being completely rewritten in JavaScript by FridgeSeal on Wednesday June 13, 2018 @09:51AM (#17303022)
> I'm very glad that you've been omniscient enough to determine what "proper" parallel support is, though. How's that working out for you? Meanwhile, those of us using JavaScript simply run one process per core

Yeah, and I can do the same thing in Python, and it will be equally as lame: both languages are fundamentally single-threaded.

You act as if JS has all problems solved: Erlang/Elixir/Golang have far superior async & parallel stories and will happily thrash JS/Node in performance and efficiency.

How’s it working out for me? Well I do a lot of stuff in Haskell and Rust now, so pretty great actually.

Re:Office 365 is being completely rewritten in JavaScript by thomascgalvin on Wednesday June 13, 2018 @07:43AM (#17302156)
> What is it missing that makes you hate it so?

1. Type Safety. TypeScript helps, but until strong typing is mandatory in the language, I can't fathom using JS in any sizable project. This is also true of Python, et al.

2. A sane dependency management framework. Maven solved this problem a decade ago. Gradle is trying to fix Maven's XML mistake. But the fact is, if I need a dependency in Java, I know how to get it. And as a bonus, Maven Central isn't going to go down next Tuesday because Timmy in Alberta threw a temper tantrum or something.

3. A sense of stability. Javascript's framework churn is just exhausting.

Re:Office 365 is being completely rewritten in JavaScript by snorremd on Wednesday June 13, 2018 @09:16AM (#17302720)
2. After the npmjs.com registry became immutable and npm got lockfiles I feel npm is pretty much there as far as dependency management systems go. I'm not sure if npm shares the cache across projects (like the ~/.m2/repositories folder for maven/gradle/leiningen), but you can get that with the yarn client if saving disk space is important.
Re:Office 365 is being completely rewritten in JavaScript by jmull on Wednesday June 13, 2018 @10:14AM (#17303227)
> ...until strong typing is mandatory in the language, I can't fathom using JS in any sizable project.

There are quite a large number of counter-examples to show type safety isn't especially important to the success of large projects.

I think the guarantees it provides are far too limited and weak to support large software systems. It relies on static code analysis, which doesn't mean much unless your app is a single build and runs as a single instance. That's more of a '90's style Microsoft Word type of app than what a typical large software project is today. Meanwhile the guarantees it does provide are only helpful to the extent developers can map their domain problems to the capabilities of the type system. Sometimes there is a nice natural fit, but usually the typesystem is both too weak (doesn't provide a convenient and natural way to impose the constraits of your problem domain) and too strong (imposes constraints your don't need or want, encumbering your development process).

Not to mention that when it comes to Javascript, you can opt-in to about as much static code analysis, including type-safety, as you want.

Re:Office 365 is being completely rewritten in JavaScript by jhall1468 on Wednesday June 13, 2018 @09:43AM (#17302941)
> until strong typing is mandatory in the language, I can't fathom using JS in any sizable project.

There are massive JS projects in production today, but that's moot. It's never going to be mandatory because that ruins the point. Typing isn't a requirement of a language.

> A sane dependency management framework. Maven solved this problem a decade ago.

A Rube Goldberg machine that solved a problem? Maven's goals may have solved the problem, but its implementation did not.

> A sense of stability. Javascript's framework churn is just exhausting.

Feature, not a bug.

Re:Office 365 is being completely rewritten in JavaScript by cm2187 on Wednesday June 13, 2018 @08:47AM (#17302501)
What creates hostility is the sentiment of being forced to use a bad language. There are many alternatives to python or php but none really to javascript (transpilers hacks apart). Webassembly might change that.

The only other language that I have seen generating as much hostility is vb6, and also I believe because some developpers found themselves forced to use it.

Re:Office 365 is being completely rewritten in JavaScript by paulie_a on Wednesday June 13, 2018 @08:55AM (#17302562)
Also VB 6 syntax was complete shit.
Re:Office 365 is being completely rewritten in JavaScript by cm2187 on Wednesday June 13, 2018 @09:04AM (#17302631)
Pretty much any old language has an odd and inconsistent syntax. I am getting into python now and it feels so much like doing VBA.
Re:Office 365 is being completely rewritten in JavaScript by bitL on Wednesday June 13, 2018 @09:22AM (#17302770)
Oh yeah, just wait until during a job interview somebody complains that you aren't "pythonic" enough, i.e. don't use some weird inconsistent syntactic wart somebody learned to love.
Re:Office 365 is being completely rewritten in JavaScript by throwaway13456 on Wednesday June 13, 2018 @08:51AM (#17302540)
Have you ever used a language like Elixir? After using Elixir, my first thought was "why the f would anyone even use JS in 2018?" That's how poor the design choices of JavaScript are. Not to mention that the name itself is trademarked by the biggest troll (Oracle corporation).

After using something like Elixir, you'll even wish if Javascript could be permanently banned from the Software industry for ever.

I use Elixir + Ruby + Coffeescript and I still wish JS was never invented.

https://twitter.com/bendhalpern/status/578925947245633536?la...

Re:Office 365 is being completely rewritten in JavaScript by always_good on Wednesday June 13, 2018 @09:38AM (#17302889)
Honestly your post just reeks of amateurism.

I used to think the same thing back when I used Clojure + ClojureScript. Hah, what idiot would choose Javascript over my god tier Clojure/Script setup?

Well, one day I actually tried to build a company and my cofounder just couldn't be fucked to learn Clojure. We decided on Node. I was forced to learn how to play nice with Javascript where I learned how to appreciate it.

Nowadays, I have a hard time justifying something like Clojure/Script over Javascript. Same with Elixir. And I am very wary of people who can't spot trade-offs since that was how I used to be, and I was wrong. I just didn't have enough experience.

There is no best. There are only trade-offs. Elixir/Clojure might be a good business decision for your project, but if you can't concede any positives to Javascript, I don't think you have a firm grip. And in the end it's always a business decision, not a technical one.

Re:Office 365 is being completely rewritten in JavaScript by bitL on Wednesday June 13, 2018 @09:26AM (#17302797)
That tweet was golden!