Usability of "allMembers and derivedMembers traits now only return visible symbols"
ketmar via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 3 08:48:24 PDT 2016
On Saturday, 3 September 2016 at 14:48:54 UTC, Martin Nowak wrote:
> On Wednesday, 31 August 2016 at 05:33:50 UTC, ketmar wrote:
>> all this mess should be resolved in compiler by assigning
>> template *two* visibility scopes: one is template's "normal"
>> scope (so it can see symbols from it's originating module),
>> and second is it's "instantiation" scope. after all, this is
>> exactly what programmer is exepecting. current solution is not
>> a solution at all, it's a hacky workaround promoted to
>> "official technique".
>
> This would require a new instance for every template
> instantiation. The instantiation scope does not leak into the
> template by design, it allows us to cache instantiations and
> greatly speed up compilation.
just a wrapper class, which will hold the actual instantiation
and a scope. most of the code should "pass thru" the wrapper (i
thing that `alias this` can be used for that, but have to check
it), yet `__traits` can use additional info. sure, that will
require some work, but it's not that impossible, and should not
ruin caching. yeah, we will waste additional 16/32 bytes per
template instance this way. not that much, and it will solve the
problem in most natural way.
More information about the Digitalmars-d
mailing list