Passing private functions to template algorithms

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 12 01:28:47 PDT 2016


On 06/07/2016 09:59 PM, Timon Gehr wrote:
> I think it is obvious that this should work. Visibility checks need to
> happen during identifier lookup. This lookup is happening in the module
> where isFileNothrow is visible.

My understanding is that right now template alias argument means
transparent symbol lookup. It acts as if doesn't access alias symbol in
template but aliased one directly.

I agree such semantics are sub-optimal but changing that can break quite
some existing idioms. Consider this snippet for example:

enum name ( alias sym ) = sym.stringof;

Right now it evaluates to name of passed symbol. If we change lookup
semantics to be non-transparent, it must always return `sym` for
consistency.


More information about the Digitalmars-d mailing list