Should templates have the instantiating scope's protection access rights?

Tofu Ninja via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 5 12:00:14 PDT 2016


On Tuesday, 5 July 2016 at 18:48:05 UTC, Tofu Ninja wrote:
> Also there could be code re-use wherever the access rights 
> match. So if an argument is marked as opt-in, only the 
> instantiation scope's access to that argument would need to be 
> tied to the template instantiation. I suppose that means there 
> would be 4 possible instantiations, one for private, package, 
> protected, and public access.

Actually scratch that, it would have to match on access rights to 
the argument and any symbol accessible through the argument. It 
would get even crazier on recursive instantiations, so I think 
you are right, the template would have to be tied to the original 
instantiation module. If the template instantiated any other 
templates that had this behavior it would also have to be tied to 
the original module. Sounds complicated.


More information about the Digitalmars-d mailing list