The correct answer to the question "How to create an alias for a function / procedure" is "You cannot."
But to simulate, there are two workarounds that can add a bit of overhead - the first is a constant, as shown in another answer.
In addition to declaring it as const, you can also declare it as a new built-in procedure:
function AliasToUpperCase(const S: AnsiString): AnsiString; inline; begin Result := System.AnsiStrings.UpperCase(S); end;
But then you depend on the compiler settings for inline, and you also need to add the AnsiStrings block where you call AliasToUpperCase , or you will get a warning H2443 Inline function has not been expanded because unit is not specified in USES list .
It works for this function signature, but for other types of returned data, you may encounter a lack of optimization of the return value and have copies of additional values.
Stefan glienke
source share