3 ms·
> Every library there is loaded. It calls a register-library function and provides a struct full of callbacks Congrats on reinventing DI ! Guess what your arra
by jcelerier 5y ago
> Every library there is loaded. It calls a register-library function and provides a struct full of callbacks
Congrats on reinventing DI ! Guess what your array of struct reacale_plugin* is called, hint, it starts with DI and ends with container
- matheusmoreira 5y agoI'm not sure anyone is reinventing anything though. This function pointer stuff is so simple I don't think anyone ever bothered to give it a name before. Even the Linux kernel is full of this stuff, kernel modules are literally this and I've never read a single comment talking about dependency injection. People invented this because Java and its friends made it so insanely hard to do it that you needed to invent convoluted techniques to accomplish the same task.
- jcelerier 5y ago> Even the Linux kernel is full of this stuff, kernel modules are literally this and I've never read a single comment talking about dependency injection. here's one: https://stackoverflow.com/questions/5925270/how-to-do-dependency-injection-in-c/10863181#comment40791186_5925270 https://stackoverflow.com/questions/5925270/how-to-do-depend...
- matheusmoreira 5y agoThat's a stackoverflow question, not Linux kernel source code. Looks like everyone there is realizing the fact dependency injection is just a simple technique that's been around for a long time. Just like I said. Mocks? Just provide a different function. It's easy.
- im3w1l 5y agoThis is unneccesarily sarcastic.