3 ms·
Really? I feel like stuff like DI frameworks are super common in Java, and they're essentially dynamic magic.
by joshuamorton 7y ago
Really? I feel like stuff like DI frameworks are super common in Java, and they're essentially dynamic magic.
- emodendroket 7y agoI'm more familiar with C#, so there may be differences, but while the DI containers do do a lot of dynamic work, it is carefully abstracted so that all code the user writes to interact with the container is type-safe. It's very rare for methods in these languages to return object or dynamic, and slightly less rare but still far from common for these to be arguments. Isn't enabling this style exactly why generic support was such a big deal?
- joshuamorton 7y ago> I'm more familiar with C#, so there may be differences, but while the DI containers do do a lot of dynamic work, it is carefully abstracted so that all code the user writes to interact with the container is type-safe. It's very rare for methods in these languages to return object or dynamic, and slightly less rare but still far from common for these to be arguments. Sure, but this is true with (most) weird dynamic code in dynamic languages too. Just look at something like `attrs`. Its letting you dynamically construct classes, but you can do so in a type safe way.
- emodendroket 7y agoThe static typing I care most about is function signatures, because it 1) helps my IDE catch me invoking things in unintended ways 2) lets me figure out how to use a function without reading it. Inside the body of a method, go nuts, I don't care. But whenever I'm dealing with a long-lived project I find signatures are a big help.