# Loading inference data

The Cyclone with Inference compiler produces a record of the inference decisions it makes and the constraints that led to them. The primary purpose of the cycinf-plugin is to show you, the programmer, what the compiler decided to do when it saw your code, and why. That way, you can modify your code to reduce the amount of runtime overhead, which currently takes the form of fat pointers, incurred for the sake of type safety.

Just as the compiler compiles a folder of code all at once, the plugin loads a folder's inference data all at once; this includes decisions and constraints. To load inference data for a folder (which must already be built), right-click it (e.g. in the Navigator) and select Cyclone -> Load Inference Data Now. A progress dialog will appear. When loading is finished, look in All Decisions for the decisions.

## Watch Inference Data

You can also check Watch Inference Data on a folder, in which case the plugin will try to reload the folder's inference data automatically every time it changes. Specifically, the plugin watches the `.cych/cvars` file, or at least how Eclipse perceives the file. (Occasionally Eclipse fails to notice a change in the workspace and you get a "Resource is out of sync with the filesystem" error; if this happens, refresh the affected files or folders in the Navigator.) To avoid being confused by a build in progress, the plugin will wait until 2 seconds pass without a change to `cvars` before reloading.

## Keeping inference data

At one time, the cycinf-plugin can hold one batch of inference data for each folder in the Eclipse workspace. Whenever you click on a folder, whether in the Resource Navigator or elsewhere, the All Decisions and All Constraints views will show the inference data for that folder; if inference data has not been loaded yet, they will show a message to that effect and will show the actual data once it is loaded.

Inference data is not saved between runs of Eclipse. It doesn't make much sense for Eclipse to cache inference data in a workspace metadata file when the information is available in a file of the project. However, what might be added in the future is persistence of Watch Inference Data between runs, in which case the plugin would automatically load inference data for all folders with this option checked when Eclipse starts.

## How the views react

When new inference data on a folder becomes available, all the inference-related views take it into account. All Decisions and All Constraints refresh if they happened to be showing that folder, which will be the case if you just right-clicked it to select Load Inference Data Now but might not be the case if the update was automatic. When possible, the Reasoning and Decision Mentions views stay on the same decision across updates; the Constraint Structure view always clears because I couldn't think of a useful way to match constraints across updates.