Toski has a special debugging feature called preview execution. You can "preview" what the result of a section of code will be, without actually running it.

It's a native Mac editor for Scheme: simply launch the app, write Scheme code, and run it.

Preview Execution

”Debugging is twice as hard as writing the code in the first place.”

-Brian W. Kernighan, 1978

In 2019, debugging still feels twice as hard. Toski introduces a new debugging technique called preview execution.

When reading or debugging code, you should be able to see what the code will do if you run it, without having to run it. That is, you should be able to see a preview of what part of your code might do.

With Toski, previewing your code is as easy as selecting a region of code.

Where Preview Execution is Useful

While Scheme as strong support for functional programming, state and mutation both exist and are common in Scheme programs.

Preview Execution is important in code that involves state or mutation of any kind. You might want to see what the result of a snippet of code is, without changing the state of the entire instance.

In Toski, if you highlight a section of code, it displays the output of the selected region. However, when you de-select that section, the Scheme instance is in the same state as it was before code was highlighted, even if the highlighted code involves state change.

How Preview Execution Works

Under the hood, preview execution works by using Scheme environments.

When code is highlighted, Toski duplicates the current environment and executes the code. Then, when the cursor is moved or the code is de-selected, Toski removes the new environment, returning the instance to the previous state.