Skip to content

Context declaration

Andrei Kurosh edited this page Aug 16, 2026 · 1 revision

If you are editing the script in an editor (e.g. VS Code) and want the autocomplete to know what kind of environment the context of your app actually provides, you can use the declare block:

declare
    reference "MyHostAssembly.dll" // in current folder or full path
    let x: int // readonly
    var y: string // read and write
    fun add:int (a:int b:int)
    type MyType = HostApp.SomeNameSpace.SomeType

It is considered best practice to only declare things that your script actually use, not everything available from the host.

The declaration block does not emit any code, but is used as a guard rail: if the declared entities are missing or do not match in signatures, then the compilation will result in an error.

Clone this wiki locally