“I want my machine to store kinetic energy in the form of momentum so I’ll cut off a piece of my machine and put it somewhere else”
– a very confused engineer
skimming through the patterns in Design Patterns, you can really tell that this book was written in 1994 by four overpaid men who probably thought Java was the coolest shit ever
“hm how can we encapsulate a function to be called? use a closure? use partial function application? nono we need to create like at least 50 lines of OOP boilerplate with templates and multiple classes and all kinds of bullshit“
the unwashed JavaScript prole: () => doAThing()
the enlightened Gang of Four:
@kasdeya hm
the SimpleCommand constructor accepts a shared_ptr, implying it will keep the receiver alive until the SimpleCommand is destroyed, but then it extracts a regular pointer and throws the shared_ptr away. they made closures with builtin use-after-free bugs!
(aside: c++ now has closures that don't do that unless told to. this unit wonders if the command pattern predates any imperative programming language having built-in closures)
@catgirl_so interesting! it might be right. honestly I get such a culture shock from just how austere the C family of languages are. I feel like at least 70% of the niceties that I take for granted in JS, Lua, and Python are probably just not there in any of those languages
so I would not be surprised at all if C++ and even C# had no concept of closures
which reminds me of that meme “look at what they need to mimic a fraction of our power”