11-Dec-2014 04:17, Walter Bright пишет:
On 12/10/2014 10:28 AM, H. S. Teoh via Digitalmars-d wrote:
Yeah, the compiler cannot instantiate the template without access to the
full body. It *could*, though, if we were to store template body IR in
object files, perhaps under specially-dedicated object file sections. It
wouldn't prevent reverse-engineering (which is moot anyway when
templates are involved), but it *would* work as an "opaque" library
interface file.
Storing it as body IR accomplishes nothing practical over storing it as
source file, i.e. .di files.
Even if we just bundle .di with .obj in one file, or better the whole
library there are operational advantages. Consider that if a compiled
library is trivially redistributable as a single file.
Importantly _always_ up to date "headers", a curse that follows C/C++ is
out of sync header files or using wrong header files.
Futher options may include pre-tokenized .di files potentially with
generated ddocs in one bundle. All in all looks like Java JAR files ;)
--
Dmitry Olshansky