First of all I’m not a language designer but just a “junior” application developer. But I want to give you my viewpoint because I know advanced developers have difficultys of thinking like beginners.
If I refactor some piece of code to a new method/function, it’s often for readability, and the ability to find that specific code easier in the future so that I can modify it, it’s part of the dividing a big problem into smaller problems idea. Reusability is the secondery benefit, which I get in theory.
What I don’t have in mind is the heap (trust me I don’t even know what exactly that is), or anything else happening in background. In my abstraction creating the new method does exactly what inline also does -> copying and pasting the code, just the over way around (well in the past I didn’t know that that’s my abstraction, I thought that this happens in reality). Secondery, inlining gives a performance boost (not always a big one, intelij says it’s not significant, but every small performance boost is welcome, especially if you are a junior and your known tools for optimizing are limited). So why not think about making inlining the default behaviour? I understand that long functions are bad for inlining because the size of code will rise. But first of all, what we have learned is that functions/methods should have single purposes. Single purpose functions shouldn’t tend to be long, so having long functions should be avoided often, why make the default behaviour (not inline) supporting the bad habbit (long functions)? Also even if a function is long, only if it gets called at separate places the inline should be a problem. A long function called just once shouldn’t take more place if I understand it right. This again shows that default inlining would be a better especially because I naively think that long functions are doing so many specific thinks at once that they aren’t reusable anyways, so they won’t get called at many places. And If you have such a specific candidate, you could simply mark it with a “don’t inline” keyword. If I’m right, inlining doesn’t work with recursion because you can’t paste code into itself, I didn’t try it I don’t know if you get a compiler error but in that case you could simply(?) make the rule “inline by default, except if there is recursion in that function”. I know that compile time is also a criteria but I don’t know if Inlining slows down compiling or not.
You can say that I’m wrong and point out my mistakes that they I could learn, otherwise if I’m correct, maybe I gave you a hint to improve the language.