Manu Evans
Manu Evans
> C++ does what you want because C's inline is not about inlining, it is about linking (necessary with header files). In D, "inline" is about inlining. Ummm, no. `inline`...
> [...] great lengths [...] You're saying templates are broken too? And we go to great lengths to break it?
Fortunately, we don't need to go to those great lengths here...
The linker's really good as its job... there's that `choose any` attribute that you put on a function, and viola. If it's in multiple objects, the linker just chooses any.
Well, 'broken' if linking fails because an object that instantiated a template didn't actually emit the symbol it referenced... I can't see how that's anything other than objectively broken. ......
This inline stuff isn't about performance; it's about link errors.
> [...] instantiate/codegen templates only once [...] When you say "only once", do you mean once ever? Or only once per compilation unit? I mean, the idea of D compilers...
> So you apparently plan not to compile & link the module containing those functions Yes, this is literally *the entire point* of `pragma(inline)` as I see it. It should...
> and that it'll thus be available in some Phobos object when linking. Talking `inline`, this is violation of expectation... but talking about templates; how can the compiler determine if...
Exactly. And this is the only definition for `inline` which I find useful... and if not that, then I need the thing I want anyway. I don't know what to...