Why would you use a thunk instead of just returning the function you want to call?

Why would you use a thunk instead of just returning the function you want to call?

Attached: Bs3IYvyIAAAHu_p.jpg (480x640, 37.69K)

Other urls found in this thread:

github.com/reduxjs/redux-thunk#why-do-i-need-this
en.wikipedia.org/wiki/Thunk
twitter.com/SFWRedditGifs

Sorry I don't speak programmer.

wtf is a thunk?

I got bait and switched into doing a web dev job and my boss kept going on about why we "NEEDED" thunks and how I was just a junior so I didn't get it, the entire thing seemed like massive typical webdev overengineering callback hell.

nakadashi

Attached: __kaname_madoka_mahou_shoujo_madoka_magica_and_1_more__e69b692944507ee3f5959830018a2c92.gif (500x500, 292.87K)

I dont even know what that is, never heard of it

Why do you keep posting her she's not even hot

what if the function needs parameters

>"she's not even hot"
You need to be institutionalized.

>thunk
explain pls I don't speak zoomer webshittery

It's sarcasm, user-you fell for the bait.

It's not sarcasm she's like a 5/10 or somewhere in that range

Redux framework trash

Better question is why would you even use redux to begin with. Redux directly contradicts with React's architecture. React normally allows you to store state variables in each component, but with Redux forces you to make everything global, so instead of encapsulation you get a singleton that stores 1000s of variables.

github.com/reduxjs/redux-thunk#why-do-i-need-this

Imagine being so webdev-brained you think Redux invented thunks. Fuck off, retards

>returning the function you want to call
That's what a thunk is

jmp thunk

thunk:
cmove rax, some_function
cmovne rax, other_function
mov rdi, end
jmp function

some_function:
xor ecx, ecx
jmp rdi
other_function:
xor edx, edx
jmp rdi

function:
xor ebx, ebx
jump rax

end:

Thunks are good in assembly, especially for writing modular code.
If you extend the tail calls to memory space, you can pretty easily create state machines.
At that point, you are writing thunks that thunk other thunks.
Link to wikipedia for those too lazy to look it up.
en.wikipedia.org/wiki/Thunk

ghc compiler exclusively uses thunks to represent all objects in memory.
basically everything whether it's a function, a number, a string is an unevaluated thunk in memory at first, until it's visited for the first time. then it substitutes in place with the result.

nakadashi

who the fuck is that even