Dynamic identifiers - Manhunter07/MFL GitHub Wiki
Dynamic identifiers are a distinct language feature that allow the access of members or declarations within a namespace by a dynamic value. That value is evaluated at runtime and must be a string. Leading and trailing spaces are ignored for qualified but not ignored for unqualified identifiers. This allows the declaration and access of for example record fields containing spaces or other unsupported identifier characters.
String identifiers
The easiest and most simple kind of dynamic identifiers are string identifiers. They consist of a single string literal instead of a plain identifier and are evaluated at compile-time, thus actually not behaving "dynamically". The following two identifiers are identical:
System.Char
System."Char"
They both link System.Char
.
Dynamic identifiers
Real dynamic identifiers are evaluated at runtime, allowing for identifiers to be unknown at compilation. It also also allows for identifiers with spaces and other unsupported characters in record fields:
const Bruce = {("Second name") = "Willis"}
Bruce.("Second name") \returns: "Willis"
As seen here, dynamic identifiers use parentheses to distinguish themselves from static identifiers. They can have any valid expression inside that results in a string value:
{("This is %g field for %s" % ([1] + Flatten([["fun"](/Manhunter07/MFL/wiki/["fun")]))) = 0.514}
\returns: {"This is 1 field for fun" = 0.514}\