FUNCNAME$ function

Purpose

Return the name of the current Sub/Function.

Syntax

f$ = FUNCNAME$

Remarks

FUNCNAME$ returns the name of the Sub/Function in which it is located.  If an ALIAS is specified, FUNCNAME$ returns the ALIAS name; otherwise, it returns the primary name capitalized.  Returning the ALIAS name provides a mechanism to disguise sensitive internal Sub/Function names even when reporting error conditions to a user.

FUNCNAME$ can be useful as a debugging tool, or in situations where an error handler in a Sub/Function passes error information on to a "central" Sub/Function for logging and handling.  FUNCNAME$ does not require #TOOLS ON.

See also

#TOOLS, CALLSTK, CALLSTK$, CALLSTKCOUNT, FILENAME$, FUNCTION/END  FUNCTION, PROFILE, SUB/END  SUB, TRACE

Example

SUB SecretEncryptionSub ALIAS "MySub" (sData$)

  x$ = FUNCNAME$  ' Returns "MySub"

END SUB

...

SUB SecretDecryptionSub (sData$)

  x$ = FUNCNAME$  ' Returns "SECRETDECRYPTIONSUB"

END SUB