Commands - Manhunter07/MFL GitHub Wiki

There are a selection of statements available that give you access to features functions cannot solve by now or could not by the time they were introduced. Commands like delete could theoretically be solved by normal functions now and might be deleted in the future. Each command begins with a designated keyword, just like statements. The difference between a command and a statement is that a statement is part of an evaluable expression and returns a value. Commands do not return any values and therefore must not be used inside evaluable expressions (terms).

resolve

See also: Identifiers#Qualified identifiers

The resolve command resolves an identifier and prints the qualified name into the application output stream. Note, that this is not the same as returning a string and or using System.Console.Write.

show

See also: Exporters

If you need information on how a declared object like a constant, variable or function looks like, you can retrieve its source code by using the show command. Note, that this is not the same as returning a string and or using System.Console.Write. This works for both custom and built-in objects. Built-in constants that use values that cannot be written in source code are not evaluated (thus, values like Inf will always return the name of the constant). Functions that do not have a syntax tree cannot have their body printed and therefore receive a placeholder comment where the body would usually appear. This is due to the fact that they are built into the compiler and not evaluated themselves. Instead, the compiler directs any calls to their call handler.

show only returns the local (unqualified) name of the object. If you need to know the qualified name of an object, use the resolve command. The source code itself is also not evaluated when show is invoked on a function. Constants that had been evaluated at declaration time will be printed as direct values rather than expression terms, because the compiler does not know how the value had been constructed earlier.

delete

import

See also: Aliases

assert

See also: Boolean evaluation

eval

The eval command evaluates a string expression as code. It is followed by a string that should contain valid MFL code.

link

See also: Packages

Once fully functional, link will import a package into the current namespace whose objects can later be used inside the current program or package. The syntax will be the following:

link Package[, NextPackage[, ...]]

Multiple packages can be linked in the same command if they are delimeted by a comma.