Ranter
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
Comments
-
@FallingUpwards I was kinda hoping for something short and unique that I can google to learn about the pattern.
-
@lbfalvy I'm not entirely sure about what you mean.
In general, command pattern as a common category.
In your specific case, I think you're looking for the word emitter?
https://www.php-fig.org/psr/psr-14/
Maybe look at the PSR - I think the definitions are well written, just ignore the PHP part. -
@IntrusionCM Command pattern was close to what I imagined, but I ended up with this weird thing that looks a lot like an in-thread load balancer instead, which ended up solving all my problems at once:
https://github.com/lbfalvy/... -
Apparently this is a very universal problem called communication, notable patterns are monads, coroutines, commands. These aren't doing the same thing, but they all serve to blur the line between caller and callee in order to give specific operations much greater access to control flow than a regular function could have.
Related Rants
I can't google jargon, what do you call it when you "flip" a function call, such that the call becomes an event in some dispatch system and return becomes a call on the event? I had to implement five such APIs this week with surface level differences and I'm starting to feel like it has to have a name if it's this popular.
For the pedantic, I mean async calls in JS in particular, I know you can't just invert a synchronous function call that uses a stack without peek.
rant
async
event
call
functions
jargon