www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Alias function with arguments

reply Jamie <notme gmail.com> writes:
Is it possible to alias a function and its arguments, but for 
that function to only be evaluated when the alias is used? For 
example

alias pragma(inline, true) inline

inline
void func(){}
Jul 10 2019
parent Hakan Aras <hakan.aras live.at> writes:
On Thursday, 11 July 2019 at 03:13:43 UTC, Jamie wrote:
 Is it possible to alias a function and its arguments, but for 
 that function to only be evaluated when the alias is used? For 
 example

 alias pragma(inline, true) inline

 inline
 void func(){}
What you're asking for is possible (see https://run.dlang.io/is/2Lh4Dr for example). However I don't believe the code sample you're showing is possible, because aliases always evaluate to types or values and you can't use either of those as a function attribute. Also pragmas are not functions.
Jul 13 2019