Idea to verify virtual/final methods
Jacob Carlborg
doob at me.com
Tue Jun 4 04:51:20 PDT 2013
On 2013-06-04 13:26, Manu wrote:
> This is a great idea. If final-by-default is ultimately rejected, I'll
> definitely try this out.
> That said, it only solves half the problem, that is, internal
> programmers forgetting to mark their functions final (and assuming they
> also remember 'checkVirtual!' in their moules).
> It offers nothing to address the 3rd party library problem.
Yes, exactly. If you override RTInfo in druntime I think it will work
automatically. Currently RTInfo looks like this:
template RTInfo(T)
{
enum RTInfo = null;
}
Override it to look like this:
template RTInfo(T)
{
enum RTInfo = checkVirtual!(T);
}
If this doesn't work you could create a tool which imports all modules
in the source code and calls the function for all modules.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list