"H. S. Teoh via Digitalmars-d" wrote in message news:mailman.2709.1417745546.9932.digitalmar...@puremagic.com...

I've often pondered about the possibility of a language where the
compiler will analyze each module and infer any number of attributes and
optimization opportunities for each symbol exported by that module, and
this information will be saved in the object file (or some other kind of
interfacing file). This includes any half-compiled template bodies and
whatever else that can't be fully codegen'd until actual use.  The
attributes will include all sorts of stuff that programmers normally
wouldn't want to deal with -- there could be 10+ or 50+ attributes
representing various optimization / static checking opportunities.  Then
every time a module is imported by another module, the compiler never
goes to the source code of the imported module anymore, but it will read
the object (interface) file, which is fully attributed, and the saved
attributes will be used internally for static checking, optimization,
and inferring attributes for the current module.

This can't be used to infer attributes that can produce errors - those attributes have to be user-visible or the errors don't make any sense. If it's purely for optimization, then that's basically what LTO does.

Reply via email to