Closed mascarenhas closed 6 years ago
Merging #237 into master will decrease coverage by
0.45%
. The diff coverage is57.97%
.
Impacted Files | Coverage Δ | |
---|---|---|
titan-compiler/coder.lua | 95.48% <100%> (-0.89%) |
:arrow_down: |
titan-compiler/driver.lua | 79.23% <54.68%> (-0.29%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 8d3b095...5702e91. Read the comment docs.
statically embedding all of the modules passed in the command line plus their dependencies where source code was present.
This is, to use a current buzzword, very "opinionated" behavior. I don't mind it myself, currently (would need to see with actual use how good/annoying this is — but I like the principle of picking an option and trying to do the helpful thing by default), but theoretically speaking, how hard would it be to make it disable-able via a flag?
how hard would it be to make it disable-able via a flag?
Very easy, we just need to tweak the default compile-time module loader to respect these flags. The hard work of mixing static and dynamic imports is already being done by the code generator, where you now pass the set of dependencies that are statically compiled instead of blanket flag that either disables dynamic loading or makes everything dynamically loaded.
To be honest l, I would not mind if the policy for titanc
would be no dynamic loading of Titan modules from Titan code, while leaving the plumbing for dynamic loading in place, along with the tests for that. It will probably be a while until someone requests a way to distribute binary-only modules.
This PR makes static linking the default when source code for an imported module is present, but still allows dynamic linking if there is no source code but a shared library for the imported module.
The
titanc
compiler now generates either one shared library for each module passed in its command line if there is nomain
function present. Each of these shared libraries statically embed all their dependencies where source code was found.If there is a
main
function in any of the modules passed totitanc
a single executable will be generated, statically embedding all of the modules passed in the command line plus their dependencies where source code was present.