3 ms·
> A compiler should do this for you. Point of inlining is to make it explicit that it is an ad hoc implementation for that location, so you don't have to be af
by Jensson 4y ago
> A compiler should do this for you.
Point of inlining is to make it explicit that it is an ad hoc implementation for that location, so you don't have to be afraid of adding more stuff in it just to solve a local problem.
- jacquesm 4y agoEasily solved with a comment and that frees you up from using it in more than one place if you ever feel like it. Inlining is a very low level implementation detail, I think making that explicit is something that you only want to do if you are breaking out the function for clarity and to be able to name it when it only lives in a single location. A bit like an assembly macro.
- Jensson 4y agoNot sure what a comment would solve. The point is that if you are making an ugly implementation for some reason, then inlining that is the right choice, breaking it out into a function that can only safely be called in that exact spot is by far the worst technical debt you can create. If you have a pile of shit then don't put it on a fan and spread it all over the room, isolate it so you know where it is and other parts can ignore it easily.