On Wednesday, 28 January 2015 at 14:16:03 UTC, Benjamin Thaut
wrote:
Well this would be ultimate goal. Although it is not possible
to automatically detect that bar needs to be exported because
that would mean you would have to analyze all possible
instantiations of the template foo. (static if...)
So Automatically detecting that bar needs to be exported is not
possible. We either have to make export into an attribute or
use the solution where bar is actually nested into a struct
which is exported instead. This is also described in my initial
post with examples.
Yes, I see the problem now. "static if" isn't even the worst
offender, any kind of string mixins that generate the call to
`bar` are impossible to detect without having actual `foo`
instance. Sorry for misinterpretation.
With that in mind second option is starting to look more
attractive despite the grammar change - forcing good chunk
template API into structs does not sound very convenient :(