Capturing Caller UDAs as CT Template Function Parameters

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 18 14:00:18 PDT 2015


As a follow up to the most

http://forum.dlang.org/thread/miri9k$2p5$1@digitalmars.com

I'm now very much interested in finding a way to make yield() 
capture the UDAs of its caller. That is instead of

void yield(T)(ref T value)

I want it to get a hold of the UDAs of the calling function and 
somehow propagate them as compile-time template arguments. 
Something like

void yield(T, callerAttributes = __traits(getAttributes, 
__FUNCTION__))(ref T value)

The problem with this is that __FUNCTION__ is a string when 
getAttributes expects a symbol. Can I somehow can a hold of the 
symbol of the caller.

Is this doable somehow?


More information about the Digitalmars-d-learn mailing list