Re: Aliases for function names?
- Posted by DerekParnell (admin) Jun 12, 2014
- 1531 views
GreenEuphorian said...
I was wondering, is it possible to define aliases for function names, so that I may have something like the following:
a=ParticularlyLongFunctionName
x=a(var1)
I guess this feature would require anonymous functions, or high order functions. Is something of this sort supported in Euphoria?
Yes, something like this supported already.
All one has to do is create a shim function and so long as it is very small, it will get in-lined as if you had actually coded the full-name function. For example ...
function a(object arg) return ParticularlyLongFunctionName( arg ) end function x=a(var1)
The generated code for this is functionally identical to ...
x=ParticularlyLongFunctionName( var1 )