Skip to content

Tiny v0.2.9 - Observer Telemetry, Dynamic VMs, and Interface Implementations

Latest

Choose a tag to compare

@confh confh released this 29 Jun 12:38

This release adds support for class interface implementations, compile-time interface verification, a live process telemetry and control library (observer), in-process compilation and nested VM instantiation (runtime), window management controls for WebView desktop apps, and developer watch capabilities.

Language & VM Changes

  • Interface Implementation Support: Classes can now explicitly declare implementation of one or more interfaces using the implements keyword. The compiler and semantic analyzer validate that the class implements all fields and methods defined by the interface.
    interface Greeter {
        greet: function(string)
    }
    
    class Human implements Greeter {
        fn greet(name: string): string {
            return `Hello, ${name}`
        }
    }
  • Compile-time Interface Verification: Improved the compiler's type checker to verify class compatibility against expected interface parameters, allowing class instances to be passed to functions or slots expecting implemented interfaces.
  • Dynamic VM Nesting: Added the ability to instantiate, control, and run isolated child Tiny VMs dynamically from within Tiny code using runtime.newVM. Child VMs can be configured with custom arguments, JIT compilation control, isolated standard library limitations, and custom global variables.
    import std "runtime"
    
    const child = runtime.newVM({
        isolated: true,
        allowedStdlib: { "io": true },
        globals: { "tag": "child-vm" }
    })
  • Host-to-VM Function Exposure: Host VMs can now register callbacks and expose functions to child VMs using runtime.VM.exposeFunction.
  • In-Process Compilation: Added runtime.compileSource and runtime.compileFile to compile Tiny source code directly to bytecode at runtime.
    import std "runtime"
    
    const code = `
        export fn calculate(a: number, b: number): number {
            return a + b
        }
    `
    
    const bytecode = runtime.compileSource(code) // returns bytecode as a buffer
    child.loadBytecode(bytecode)
    const result = child.call("calculate", [10, 20]) // returns 30
  • WebView Window Controls: Added support for frameless windows, showing/hiding windows, drag and resize operations, window minimization, maximization, restoration, and programmatically closing windows.

Tooling & CLI Changes

  • Watch Mode: Added the watch command (tiny watch or tiny --watch) to monitor a source program and all of its imported file dependencies for changes. The command clears the screen and restarts the program upon file edits.
  • Executable Icon Customization: Added the --icon flag to tiny pack and tiny dist to set a custom .ico file icon for Windows executables.
  • Runtimes Auto-Update: Updated tiny update to check the local runtimes directory ($HOME/.tiny/runtimes) and update each cached target runtime binary to match the latest compiler release.

LSP Changes

  • Multiline String & Comment Filtering: Rewrote string and comment boundary resolution to run a document-wide scanner. Unused inlay hints, diagnostics, hovers, implementation lookups, and auto-completions are now correctly ignored inside multiline string literals (backticks) and comments.

Standard Library Modules

  • Observer (Telemetry): Added the observer standard library module. It starts a local telemetry HTTP endpoint exposing memory statistics, task pools, variables, functions, and events, allowing remote control of the running VM.
    import std "observer"
    
    observer.start({ port: 4040, password: "tiny" })
    observer.status("processing tasks")
    observer.event("job.started", "Task queue initiated")
  • Telemetry Dashboard App: Added the observer developer application under observer/src/main.tiny, which uses ui WebViews to connect to the observer HTTP endpoint and visualize VM telemetry.

Installation and Downloads

To install Tiny, download the compiler binary for your specific operating system:

  • Windows: Download tiny_windows_amd64.exe
  • Linux: Download tiny_linux_amd64 for amd64 or tiny_linux_arm64 for arm64
  • macOS (Apple Silicon): Download tiny_darwin_arm64

Note: The tiny_runtime_* assets listed in the releases page are managed automatically by the compiler during the pack and dist commands. You do not need to download them manually.