Re: Using a macro for a function signature

2016-04-05 Thread pineapple via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 13:17:38 UTC, Anonymouse wrote: You can't get rid of the signature completely as the functions still need a parameter list with x declared. You will get "Error: undefined identifier 'x'" otherwise. You can largely omit the *type* of x if it can be inferred from the

Re: Using a macro for a function signature

2016-04-05 Thread ag0aep6g via Digitalmars-d-learn
On 05.04.2016 13:35, pineapple wrote: alias somelongsignature = int(in int x); alias somelongsignature = int function(in int); Or if you want to accept methods and such: alias somelongsignature = int delegate(in int); You can name the parameter, but it won't be part of the type. int

Re: Using a macro for a function signature

2016-04-05 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 11:35:24 UTC, pineapple wrote: If I have a common function signature I'm using throughout my code, and I feel like there should be a way to condense it using a macro. The intuitive method isn't working, but this seems like something D would be able to do. What've I

Re: Using a macro for a function signature

2016-04-05 Thread pineapple via Digitalmars-d-learn
Ah, aside from the mismatched "examplefunc" numbers - please disregard Can't post example code without stupid typos for the life of me