Skip to content

CEP-0022: Standalone Type Qualifiers

Draft

Draft proposal for standalone type qualifiers such as const T. V1 models constness through bindings, pointers, slices, and specific type forms.

Summary

Catalyst should eventually decide whether standalone qualifiers can modify arbitrary type expressions.

V1 does not have a general const T type qualifier. It has immutable bindings, *const T, readonly slices, and other focused forms with explicit semantics.

Example

Possible future shape:

fn inspect(value: const Widget) {
  value.draw_preview()
}

const FrozenWidget = const Widget

V1 writes constness at the binding, pointer, or slice form instead of treating const as a standalone modifier for any type expression.

Motivation

A general type qualifier can be concise, but it risks blurring binding immutability, pointer authority, value semantics, and ownership. Catalyst should not add it unless the qualifier has clear behavior across structs, arrays, slices, optionals, dynamic values, and contracts.

Proposed Direction

The proposal should cover:

  • which qualifiers exist;
  • which type expressions can be qualified;
  • whether qualifiers affect value mutation, binding reassignment, pointer authority, field mutability, or API compatibility;
  • how qualified types compare for identity and coercion;
  • how qualifiers display in reflection and diagnostics.

V1 Compatibility

V1 keeps constness in explicit constructs such as bindings and pointer/slice types. Standalone type qualifiers remain unavailable.