System.NameOf - Manhunter07/MFL GitHub Wiki

Declaration

function NameOf(Obj: ref): System.Identifier = \built-in\

Description

The NameOf function in the System package allows the determination of an object's name (identifier). The result will be a string without spaces or special characters (supported by Identifier). The argument is supposed to be a reference to the object whose name should be returned. Supported are all addressable objects (variables, functions and types). Non-addressable objects like constants are not supported as arguments. There is no way to determine their name at runtime due to compiler optimizations.

Anonymous functions

References to anonymous functions (those constructed by the func-ret statement are supported, but return an empty string (""). They will however not raise an exception or behave differently. This also poses the easiest way of finding out if a function passed as an argument for example is a named (declared) or an unnamed (anonymous) one.

See also