Skip to content

CEP-0026: Comptime Host Access

Draft

Draft proposal for controlled host access during comptime evaluation. V1 comptime is deterministic, sandboxed, and does not access host resources.

Summary

Catalyst should eventually decide whether comptime code can access host resources such as environment variables, current time, randomness, files, network, or shell commands.

V1 disallows these effects so comptime evaluation remains deterministic, cacheable, and tool-friendly.

Example

Possible future shape:

fn build_info(comptime host: HostAccess) => BuildInfo {
  return BuildInfo {
    git_sha: host.env("GIT_SHA"),
    generated_at: host.now_utc(),
  }
}

The proposal must decide which host capabilities are allowed and how their dependencies are recorded for reproducible builds.

Motivation

Build-time data and generated bindings sometimes need host input. Uncontrolled host access would make compilation nondeterministic and hard to cache, reproduce, or explain in tooling.

Proposed Direction

The proposal should cover:

  • explicit capability values for host access;
  • dependency recording and cache invalidation;
  • sandbox policy and reproducibility;
  • diagnostics for denied host effects;
  • interaction with package builds, generated declarations, and tooling;
  • whether different build profiles allow different host capabilities.

V1 Compatibility

V1 comptime cannot access host resources. Unsupported host access during comptime is a deterministic compile error.