Skip to content

Function Aliases

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Function Aliases

Function aliases can be used to have multiple names refer to the same function definition

func alias myFunctionAlias => realFunction
func alias myFunctionAlias(ArgType1, ArgType2, ArgTypeN) => realFunction

Target Determination

If the argument types of the function alias are specified, then they will be used to determine which implementation function to use. Otherwise, the first function that has the specified implementation name will be chosen.

If no argument types are specified and there are multiple implementation possibilities, then a warning will be raised.

Alternative Syntax

Alternative syntax can be used with function aliases as expected.

myFunctionAlias :: func alias => realFunction
myFunctionAlias :: func alias (ArgType1, ArgType2, ArgTypeN) => realFunction

Overlap with Existing Functions

If a real function and a function alias have the same name and arguments, then the first to be declared will be used.

Clone this wiki locally