Came to these two articles of yours from your reply on another one where you said you kind of like arrow functions, in response to my distaste for them.

Though much of my hatred of them stems from how painfully cryptic and vague their syntax is, oft reeking more of "wah wah, eye dunz wunna type" than any actual legitimate reason for improvement, this article does a stellar job of outlining how I've come to hate how people are using them. Whilst certainly these are just short examples, they are typical of what people are wasting them on and shows the same lack of forethought that led to the creation of the derpy and ultimately pointless LET and CONST... aka trying to solve a problem that shouldn't exist in the first place and just making everything WORSE as a result.

The biggest of these problems being "callbacks for EVERYTHING!!!" -- which from a performance and efficiency standpoint is just going 100% Gungan on one's logic. Meesa sayz yews nevah goes FULL Gungan.

Every time you introduce a function call -- even arrow ones -- you're creating -- even in interpreted languages the equivalent of -- a push to the stack of variables or pointers, a far call, and at function end a pop off the stack and a return. At LEAST four extra operations -- real world more like a dozen in an interpreted language like JS -- that you just don't need.

... and if you weren't wasting a "function for nothing" with the equally derpy "forEach" you wouldn't have the scoping problems in the first huffing place.

What the blazes is wrong with just:

for (var employeeName of this.employee) { // AND THEN DO IT!

or if stuck working client-side where for/of doesn't exist:

for (var i = 0, employeeName; employeeName = this.employee[i]; i++) {

Assuming of course that all this.employee wouldn't ever be loose false. JUST DO IT, don't wrap it in some garbage "function for nothing" and an even dumber callback handler like Array.each. You're banging the brakes on performance and wasting "code for nothing". A simple for/of is all you need in the majority of these cases. I would even argue that for/of should make Array.each obsolete in the vast majority of cases... unless of course you have a legitimate reason for a callback such as code that's called from multiple different spots, and even then pass it as an argument with a normal for/of and not some garbage method requiring callbacks.

I'm seeing that so much now, people wasting anonymous functions and callbacks for things they aren't actually calling from multiple places, are barely even one-liners, and introduce scoping issues they could have avoided if they just flipping did it with an old-fashioned loop. People need to STOP MAKING PROBLEMS THEY DON'T ACTUALLY HAVE!

Which brings up the other "problem" with arrow functions, not only does the "functionality" they provide just bespeak shoddy/broken scripting / interpreted language practices and a failure to grasp what JS is even for, they flat out break legacy support by their very presence. Whist sure server-side that doesn't matter one lick, I still deal with clients that DEMAND at least IE 11 support. I'd say this type of thing client side is at LEAST three to five years "too soon"... but given they don't do anything that I can't just avoid having the headaches of in the first place, what possible reason is there to be using them this way?

So not only are they painfully and aggravatingly cryptic (but as an old school Pascal/Ada guy, I say that about all C syntax languages), providing little to no legitimate improvement in functionality, they also end up actively encouraging practices that result in bloated slower code?!?

Admittedly, my having started out hand assembling RCA 1802 machine language and my first high level language being UCSD Pascal -- much less a decade of working in Ada -- colours my impression of what clear comprehensible code should be and how I solve problems, but seriously many of these "additions" to ECMAScript of the past few years feel like little more than an attempt to shoe-horn in bad ideas from other languages just for people who likely shouldn't be using JS in the first place.

I'll pass. I suggest everyone else does as well.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store