Skip to main content
NM-RFC-0001

Module visibility

Design document · English reading edition

RFCs record designs and changes. A proposal appearing here does not mean its feature is ready to use. Explore current language support

Status recorded in the original: Tooling experimental

Bound original source · SHA-256
7b04c505f91a0d970545ec6820bcd4c3c638da58014515706ae26ef1d2a82cea

Reading edition reviewed: 2026-10-02

Purpose and scope

Makes the circuits, observables and constants exported by a module explicit. Changing an implementation helper should not accidentally change the public contract seen by consumers.

Core design rules

  • public and private apply only to top-level circuit, observable and const declarations.
  • Workspace resolution, package resolution and the language server must carry the same visibility meaning.
  • Legacy source without a visibility modifier retains behavior according to the compatibility rules in the transition contract.

Example from the original

This example illustrates the design recorded in the original. It is not by itself a claim of executable or stable support; check required options and the current version.

nm
module bell_library;

private const HALF = PI / 2;

private circuit prepare_phase(data: QReg<2>) {
  Ry(data[0], HALF);
}

public circuit prepare_bell(data: QReg<2>) {
  H(data[0]);
  CNOT(data[0], data[1]);
}

public observable parity = Z(data[0]) Z(data[1]);

Limits and interpretation

  • fn main, param, executable statements and nested declarations are outside this visibility slice.
  • Visibility checking alone does not establish that a package is published or trusted.

Status and implementation boundary

The source records an experimental tooling slice. Check the current capability record and tool options before assuming that the installed version accepts visibility declarations.

Table 1
Review topicInformation to check
Source revisionSHA-256 digest bound to this reading edition
AvailabilityCurrent capability record and tool options
Evidence boundaryModel, size and interpretation limits above