Tooling
This section covers various tools that help to work with the Wolfram Compiler.
CompilerInformation
When writing compiled code and you need to see what functions and types are known to the compiler, you can use CompilerInformation.
Functions
For example, to see what versions of Dimensions are supported, you can do the following:
This says that there is one version available that will work for packed and numeric arrays. It will return a packed array of integers.
Sometimes, there are many versions of a function. For example, if you want to create a "CArray" and you know that you can use CreateTypeInstance but you want to check the details, you can use CompilerInformation; however, there are many results, and it is hard to see which one you want:
To solve the problem of many results, you can use Typed with a pattern. Here, this shows all the versions of CreateTypeInstance that return a "CArray". This significantly reduces the output and makes it easier to see what might be useful for you:
One issue to be aware of with searching is that many functions are defined polymorphically. For example, this is the information on Identity. This works for any input:
It obviously makes sense not to have different versions for every single type, but it means that when you look for support for a function, you have to be aware that it might be supported with polymorphic code. In order to find if a particular usage is supported, you could use TypeOf, which is demonstrated later.
CompilerInformation for functions supports a number of properties, as shown below:
Types
CompilerInformation also returns useful information on types. For example, the following gives information on the "Integer64" type:
The properties for types can be quite useful:
This shows the abstract types that "Integer64" implements. Any polymorphic function written with a restriction to one of these abstract types will work for "Integer64":
You can also get information on an abstract type:
One useful aspect of CompilerInformation is that it can show features such as operations or a creator. The following shows information for "HashSet":
Additional Declarations
If you add your own declarations to a compiler environment, these will also be found by CompilerInformation. The following adds a type to the default compiler environment:
Now CompilerInformation knows about the new type:
This restores the compiler environment to the default:
Progress Monitoring
When you carry out compilations that take more than a second, typically a progress monitor is shown. This gives some information on the compilation. A screenshot is shown below:
There is a global variable, $ProgressReporting, that controls whether reporting is shown for a variety of functions. Setting it to False will suppress reporting.
In addition, there is an option, ProgressReporting, that can be set for FunctionCompile and related compilation functions. Setting it to False will suppress progress reporting, as in the following:
Compilation Errors
When you carry out compilation, it is possible that some problem in the code will prevent success. When this happens, useful messages can be issued. Additionally, there is a system to help you locate the source of the error.
For example, the following function does not compile because there is no definition of Sin for a Boolean:

Clicking the "Source" button reveals a popup that marks the function with the source of the error:
In case there is a sequence of declarations, the popup is more elaborate. For example, the following sequence of functions fails to compile:

The error popup looks like this:
The individual functions are marked with the name and type, in addition, there are openers that help to show the code.
If there is a function nested inside another function, the error reporting still works:

The popup looks something like the following:
The popup will clear itself automatically when the notebook is used. However, it also has a breakout icon:
. This opens the error information in a separate notebook that can be saved for future reference.TypeOf
The TypeOf function can be used inside compiled code to extract the type of some compiled entity. It can also be used inside TypeEvaluate in type declarations to select a particular type.
Another use of TypeOf is in top-level code to extract the type of a function. It can verify that the code can be compiled, but it stops once the type has been generated. This makes it much quicker than running the entire compilation with a function such as FunctionCompile.
For example, you can invoke TypeOf on the following and it returns the type of the function:
If there is an error in your function, it quickly uses the error reporting system:

Another use of TypeOf is to help develop polymorphic declarations. These can be quite difficult to develop.
As an example, suppose that you want to develop a function that takes a scalar and returns a matrix. You want to be polymorphic so that if the input is a real number the result is a real matrix of the same elements, but if the input is complex, the output should also be a real matrix with the base elements.
So for "Real64" input, the output should be "NumericArray"::["Real64"], but for a "ComplexReal32" input, the output should be "NumericArray"::["Real32"].
Here is a declaration that only has a type; it has no actual implementation:
This calls a number of TypeOf uses that show the declaration does what is desired (note how TypeOf takes the declaration after the function, which is in contrast to other compiler functions like FunctionCompile):
This seems like the declaration is working for type. After this, it will be necessary to add the actual implementation of the function. The benefit of working like this is that a complicated task can be split into parts, and each can be solved separately. It is also beneficial to work with type declarations interactively using Wolfram Language notebooks.