On Tuesday, 21 June 2016 at 10:39:52 UTC, David Nadlinger wrote:
On Monday, 20 June 2016 at 08:10:19 UTC, Dicebot wrote:
How about defining semantics like "try inlining if possible,
fallback to always emitting symbol to object file otherwise"?
That would also allow compatible implementation in dmd.
This would get rid of the undefined symbols, but there is a
much more subtle problem here that nobody has brought up yet:
If the template ends up being emitted twice with different
mangled names, then, well, it ends up existing twice in the
final executable.
This is not really an issue for functions, but very much so for
data symbols (e.g. a static variable inside a function), where
you could end up with the same alias referring to two different
pieces of data depending on where it is used from.
The root of this issue is that __FILE__ introduces incidental
environmental state into the otherwise pure module system.
+1