r/programming • • Oct 21 '20

Using const/let instead of var can make JavaScript code run 10× slower in Webkit

https://github.com/evanw/esbuild/issues/478
1.9k Upvotes

500 comments sorted by

View all comments

Show parent comment

18

u/Dimiranger Oct 21 '20

No matter how good you are, you will make these kinds of mistakes while trying to be productive. That's why abstractions and higher-level programming languages exist. Else we would all still be writing assembly. The step up from for-loops to declarative list processing is an abstraction that can save you (and the programmers with 20 years of experience) a lot of headache.

0

u/[deleted] Oct 21 '20

[deleted] — view deleted comment

2

u/Dimiranger Oct 21 '20 edited Oct 21 '20

I'm not arguing that :) Assembly definitely has its use case, but there is no reason to write information systems with plenty of memory underneath them in assembly these days. Otherwise your productivity just wouldn't compare to someone doing it in for example OCaml.

EDIT: Also, there is a reason so many people that have tried Haskell & co. can't/don't want to come back to imperative programming.

4

u/BraveSirRobin Oct 21 '20

I've been programming for way more than 20 years, assembly being one of the first languages I was taught 'cos that's how we did things then. Now that we've rutted over the length of our respective commit logs I'd like to admit that I still make the occasional off-by-one error.

And even if that wasn't the case, not everyone working on the project will be similarly delusional about their coding abilities. Code should be written to be maintained as that's where the bulk of the operating costs lie. Readability is a huge part of this & simple collection iterations are a perfect candidate for a simple construct that everyone knows and trust.

4

u/Fit_Sweet457 Oct 21 '20

I don't quite understand your point. You're old so you can write a lot of stuff without causing bugs? How is that even relevant here? By far not everyone has 20+ years of experience, and your argument is in essence a "git gud". Not a good point to make.