aliased functions
Carlos Santander
csantander619 at gmail.com
Tue Mar 20 15:49:16 PDT 2007
Dan escribió:
> Hi guys,
>
> I was just going through my huge methods file, and I thought to myself that it might be beneficial if we somehow allowed ourselves to use:
>
> alias int function(int x, uint y) myFunctionStandard;
>
> myFunctionStandard myFunctionName {
> functionContents...
> }
>
> Reasons? Keeping it all in one place could reduce errors, make it more readable, and less verbose. I have a file with over 180 methods that all have identical parameters so they can be called through a common mechanism.
>
> Alternatively, anyone have a template for this already?
Something like this?
alias int function (int x, uint y) myFunctionStandard;
int foo (int a, uint b)
{
return 0;
}
myFunctionStandard myFunctionName ()
{
return &foo;
}
It's legal D, btw.
--
Carlos Santander Bernal
More information about the Digitalmars-d
mailing list