On Tuesday, June 04, 2013 02:10:40 Andrei Alexandrescu wrote: > On 6/4/13 2:04 AM, deadalnix wrote: > > On Tuesday, 4 June 2013 at 05:58:32 UTC, Andrei Alexandrescu wrote: > >> Unless fresh arguments, facts, or perspectives come about, I am > >> personally not convinced, based on this thread so far, that we should > >> operate a language change. > > > > export => finalization as LTO ? > > I see some discussion about that at http://goo.gl/KIl8L, but am unclear > on the exact idea. Is it some sort of class hierarchy analysis during > link time?
The idea is that any function which isn't overridden shouldn't be virtual. However, in the normal case, there's no way of knowing whether a class will be derived from or whether any particular function will be overidden. Code can be compiled separately such that the compiler has no clue what derived classes exist. However, in the case where you have a shared library and all symbols which will be used outside of the library must be exported, the linker could theoretically examine every function which is not exported and make it non- virtual if it's not being overridden, because no code outside of the shared library could possible override it. This will only help functions which aren't exported, and will only work on Windows, as no other platform currently requires that symbols be explicitly exported. It also requires that the linker do this, and as long as we're using the C linker, I don't know how it could. It would need to understand virtual functions (and possibly D virtual functions specifically) in order to make the optimization. - Jonathan M Davis
