Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "arrow function"
-
New JS arrow functions:
⇶ (“the gun rack”) – executes three times
↝ (“wiggly boi”) – finds the least efficient solution possible
⟳ (“the self-monch”) – executes forever
⍆ (“🤷”) – adds random side effects
⍅ (“the total and complete s**t”) – undoes the only useful and expected part of its execution
Absolutely hilarious 😆
https://medium.com/@Heydon/...3 -
Every single diagramming tool.
All the SaaS ones are either way too limited in function, or proprietary vendor-locked.
All the FOSS/desktop ones have a 90s UX experience.
I really want to make a great, comfortable-to-use diagramming tool which just directly uses SVG as the file format, but without the "FUCK IT DOESNT ALIGN CORRECTLY AND WHY IS THIS ARROW BEHIND THE REST" experience...
But I know deep down that it's hard work, and I'll probably get stuck delivering the gazillionth lackluster, bugged diagramming app.20 -
I don’t like to judge people based on what languages they like (because I like all of them). But I can’t deny the pattern anymore.
Smart people know and enjoy smart languages: Smalltalk, OCaml, Clojure, Lisp, Haskell, etc. They may use JavaScript or PHP to make money, but ask them to code in their smart language and they’ll be more efficient. Getting old, some of those people say “screw it” and find a Haskell job.
You, my friend, are not one of those people. You are VSCode-dwelling goblin who thinks lambda calculus has something to do with JS arrow function notation, is scared of reduce() and not even good at the single fucking language they know.
Insta coders and that mechanical keyboard collector dorks are not “superstars” you got to be like.11 -
I’m new to C# and Visual Studio gave me an option to change the way I wrote the main function.
It gave me this.
Does this remind you of fat arrow function in JavaScript?7 -
I never thought clean architecture concepts and low complicity, maintainable, readable, robust style of software was going to be such a difficult concept to get across seasoned engineers on my team... You’d think they would understand how their current style isn’t portable, nor reusable, and a pain in the ass to maintain. Compared to what I was proposing.
I even walked them thru one of projects I rewrote.. and the biggest complaint was too many files to maintain.. coming from the guy who literally puts everything in main.c and almost the entire application in the main function....
Arguing with me telling me “main is the application... it’s where all the application code goes... if you don’t put your entire application in main.. then you are doing it wrong.. wtf else would main be for then..”....
Dude ... main is just the default entry point from the linker/startup assembly file... fucken name it bananas it will still work.. it’s just a god damn entry point.
Trying to reiterate to him to stop arrow head programming / enormous nested ifs is unacceptable...
Also trying to explain to him, his code is a good “get it working” first draft system.... but for production it should be refactored for maintainability.
Uggghhhh these “veteran” engineers think because nobody has challenged their ways their style is they proper style.... and don’t understand how their code doesn’t meet certain audit-able standards .
You’d also think the resent software audit would have shed some light..... noooo to them the auditor “doesn’t know what he’s talking about” ... BULLSHIT!9 -
Anyone who has experienced this without falling into desperation deserves a beer, I know I need one.
Colleague: Python says I have an indentation error, halp. *Sends screenshot*
You: okay, it says it's located on file.py line 39. Can I see the related line?
Colleague: *sends a screenshot of the whole file, without numbered lines*
You: ummm, could you send me the related lines tho?😐
Colleague: 😒 yeah. *Resends a screenshot of the error and the whole file...again*
You: I REALLY need you to send me only the function scope to help you cuz I can't visually debug the whole file on a picture.
Colleague: *sends a panned phone picture with an arrow to the function (half of it)*
Plot twist: she's your girlfriend.
[EDIT]
GF: I can't see it, I'll go have a snack.1 -
I was just chatting with my dad. He used to be mostly a C# dev but changed jobs and is now doing mostly Java. He says he likes it better.... Because it doesn't have lambdas/anonymous functions.
Uh.... Java was the first and only language where you can define interface implementations in-line (aka a whole bunch of functions)...
And 1.8 supports lambdas for Interfaces that have a single function...
I bet he'll hate JS... Where functions are can be passed around like objects, ES6 now supports lambdas and await, async... and anonymous functions (apparently they're called arrow functions?)9 -
I need a way to explain to a coworker that nesting if statements beyond 3-4 is too much and needs to be re thought out. The dude is the biggest arrow head programmer I’ve ever seen. And he claims nothing is wrong with it, it works.. so what’s the problem.
Since we follow the rule of only one return per function he claims it’s the only way to accomplish the stuff he’s doing.. like if blah function passes... if blah function passss if blah functions passes do this then if blah functions
The if statements arnt just checking some variable conditions.. the conditions are checking returns of functions at each nested level the condition, executes a different function and thus checked for success.
Uggh I just don’t know how to explain to him it’s shit and needs to be re designed
Any ideas??20 -
These are the rules that apply to all of my JS projects:
- 100% typescript, “any” is not allowed
- strict prettier with pre-commit hook
- no semicolons
- no braces around single argument of an arrow function
- tabs7 -
<warning>bad words</warning>
WHAT THE ACTUAL FUCK!!! LibreOffice Impress is a complete shit!! I am all about open source and such but this shit just sucks, moving elements around a frame snaps them to some grid, however when you paste an element from other frame it will have a different grid!!! This motherfucker has got an ALT function that will allow you to move the element more precisely but it only works seldom and it hates it when I try to use the fucking arrow keys - it even crashed once when I tried it. AND WHEN YOU FUCKING COPY A TABLE FROM ONE FUCKING FRAME TO ANOTHER MOTHERFUCKING FRAME, DELETE A FEW ROWS AND THEN COPY THE FREAKING TABLE BACK IT WILL HAVE MAGICALLY DIFFERENT DIMENSIONS BUT JUST EVER SO SLIGHTLY, BECAUSE FUCK THE USER, RIGHT??!!! (Doing this because there is no way to split tables into two different objects) I constantly have to save my presentation, kill the process and open it again because something just stops working or gets stuck, like seriously, WHAT THE ACTUAL FUCKING FUCK???!!! Are there no tests?!!! Do the people who work on this piece of motherfucking shit even use it???!!9 -
Please fucking tell me there's a better cleaner way to write this render() function?
The use of so many "in-line" code evaluations, arrow functions, (), {}, ...
Just spent like probably 30 minutes just trying to figure out what closes what...
And the author is inconsistent?
Sometimes he uses map( location => { return ... })
other times he uses setState((prevState) => ({ key: this.state.keyValue}))
And there's no note as to why... are they interchangeable, used in specific cases, does it matter????!!!!!!
Or is he just trying to demonstrate 1000 different ways you can say the same thing in JS?
!@#!#@!$#%#$!@#!@#!#$$%30 -
Lua users, have you used moonscript?
It's a little language that has it's own interpreter or can be compiled down to Lua and it's absolutely lovely (currently using it with Love2d).
Of course, as with most things, what I love about it also royally pisses me off sometimes.
For starters local has to be declared for variables, unlike lua.
Otherwise the variable goes to _
Also note, that some tutorials literally tell you the opposite.
all variables are local by default
unless you don't declare them
then they go to _ (throwaway)
Some tutorials get this wrong too.
all variables have to be declared local
except tables. failure to declare a table WITHOUT a local will cause things like
table.insert to fail with "nil" values for no god damn reason.
No tutorial I could find mentioned this.
Did you know we call methods with '\'?
By the way, we call methods with '\'.
Why? Who the fuck knows.
Does make writing web routes more natural though.
Variables in the parameters of new are declared and bound for you. Would have loved to know this before hand instead of trying
to bind to them like a fucking idiot.
Fat arrows are used to pass in self for methods.
Unless you're calling a method. Then you use backwards slash. This fact is unhelpful when you're a beginner and dealing with the differences between the *other* arrow, the backslash, the fat arrow, and the fact that functions can be called with or WITHOUT parenthesis.
And on that note..
While learning all this other shit, don't forget parenthesis are optional!
Except when they're not!
..Like when you have a function call among your arguments and have to disambiguate which args belong to the outer call and to the inner call! Why not just be fucking consistent?
But on the plus size, ":" is now used for what it should have been used for in the fucking beginning: binding values to keys.
And on the downside, it's in a language thats built on top of another language that uses it for fucking *method calls*, a completely
different fucking usage.
And better still, to add to that brainfuckery thats lost in the mental translational noise like static on a fucking dialup modem, you define methods with the fat arrow. Wait, was that the single arrow or fat one? Yeah the fat one. Fuck. But not before you do THIS shit..
someShit: =>
yeah, you STILL include the god damn colon just so when you're coming from lua you can do a mental double take. "Why am I passing self twice? Oh right, because fuck me, I decided to use moonscript." It's consistent on that front but it also pisses me off.
A lot of these are actually quality of life improvements disguised as gotchas, but when you're two beers in to a 30 minute headscratcher it sure doesn't fucking feel like it.
Nevertheless, once I moved beyond the gotchas, it was like night and day. Sure moonscripts takes a giant steaming dump all over the lua output, like a schizophrenic alcoholic athena from the head of zeus, but god damn, when it works it just WORKS.
Locals that act like locals? Check.
Sane OOP? Check.
Classes, constructors, easy access to class methods, iterators? Check, check, check, check, check.
I fucking hate ceremony. Configuration over convention is for cunts. And moonscript goes a long ways toward making lua less cunty.
If you've ever felt this way while using lua, please, give moonscript a try.
You'll regret it, but in a good way!6 -
I hate the overuse of arrow function everywhere even for super long expression. that `function` should fit to them more comfortably .
writer of code should aware that it take three time more to read expiration with arrow function inside5 -
Omg I loath path separators. Been working on windows most of the time (bought a surface pro for some reason) and my colleagues work on Linux. We just do standard web dev stuff nothing special but. I started having issues with my windows build getting weird function.prototype.bind.apply is not a constructor issue. Which is valid because apparently my colleagues started using the fat arrow function everywhere and on places where not needed.......
But on Linux they never had an issue because babel fixed it to the old function during the transpileee. So why the fuck am I getting this problem. After some tedious debugging and asking my colleagues. (colleagues only responded with just use Linux) I found the the issue to lie in the webpack loader for the Javascript in which the path regex used a single / :(. So I changed that to a group to be / or // and bam the whole bloody project works on windows now.
....... My colleagues still don't understand that they over use the fat arrow in the wrong places unfortunately3 -
I hate arrow functions in ES6! Whenever I see them, I get acute code dyslexia and can't read shit. What the fuck is wrong with writing function, why change it for some unreadable series of symbols?10
-
So basically after using arrow functions for 6 months I discovered just now that it also passes it's enclosing scope. The more you know7
-
After the fun I had with the XEN Orchestrator UI ( https://devrant.com/rants/2554182/ ) I build an exporter that normalizes XEN / Proxmox API output and writes it into a nice spreadsheet.
Took PHP 7.4 for a spin. Sweet jesus, lot of nice stuff.
Been nearly a year since I did something larger than small scripts in PHP, but felt really at home again.
The type hinting and arrow functions made writing the exporter a breeze.
DTOs with typed properties spared me quite a bit of headache when normalizing the different APIs...
Utilizing *sort with fn arrow function is a pretty nice and concise one liner with the spaceship operator.
And I have now a nice spreadsheet...
Thanks at the PHP folks.1 -
Does anybody use a 60% keyboard? I want to buy this, https://annepro.net/products/...
Arrow keys with press of fn and no distinct function keys, but it seems doable. Will I have problems using this with emacs?12 -
stop using arrow function everywhere!!!!!!!
what that is mean ?
fns.reduce( (prev, fn) => fn(prev), input)
Are this is `fns.reduce` with two parameters
Or arrow function that return `input` variable.
take your time to visual parsing this crap4 -
Learning ES6 arrow functions from Kyle Simpson's workshop video. Amazing how something that was designed to be a syntactic sugar turned out to be a code readability nightmare :(1
-
The difference in arrow function and traditional function? Yes. What? This is the difference. What?4
-
Why shall I convert my utility functions into arrow functions?? I really don't see the point.
I think it is way more descriptive to read a line going
"export function buildEntity(){"
Instead of
"export const buildEntity = () => {"
When are you using arrow functions? Do you see any benefits there?12 -
{
regular: function () { return this }, // ok
arrow: () => { return this } // you mean undefined?
}3