Passing private functions to template algorithms

Basile B. via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 7 23:24:54 PDT 2016


On Tuesday, 7 June 2016 at 18:45:23 UTC, FreeSlave wrote:
> I want to bring up this unpleasant topic for discussion, 
> because I'm really tired of hacks I need to do in my code.
>
> [...]
>
> How about allowing templates from other modules to have access 
> to private functions? I think this would be pretty legal 
> behavior, since template is instantiated in this module anyway.

Yes, I agree. This is also a concern for me. I've encountered a 
more specific case when using traits 
(https://issues.dlang.org/show_bug.cgi?id=15371). One possible 
fix would be to allow templates to be instantiated in the module 
that uses them.
But I have no idea on the fisability.

The consequence now is that a lot of good templates can't be 
added to std.traits (for example to simplify the __traits() code) 
because introspection would only work on public symbols.


More information about the Digitalmars-d mailing list