The "no gc" crowd
Adam D. Ruppe
destructionator at gmail.com
Tue Oct 8 16:06:30 PDT 2013
On Tuesday, 8 October 2013 at 22:53:35 UTC, Walter Bright wrote:
> What you're suggesting is called "interprocedural analysis" and
> doesn't work in a system with separate compilation (meaning
> that function bodies are hidden from the compiler).
Eh, that's not a dealbreaker, especially with phobos and druntime
where the source is always available anyway.
Though, my proposed __traits could perhaps be improved to just
offer two things:
__traits(getFunctionsCalled, function)
returns a tuple of all functions called. These would ideally be
in the form of symbols.
__traits(functionBodyAvailable, function)
true if the source was available to the compiler.
And that's it: the rest is done in the library using existing
language features. Then we can decide in library code if a
missing attribute is a problem based on if the body was available
or not.
Note that this isn't specific to the gc: it would provide the
necessary foundation for all kinds of library extensions in the
same vein as @safe, with the possibility of automatic inference
from the prototype + presence of body.
More information about the Digitalmars-d
mailing list