Skip to content

CEP-0031: Attribute Semantic Effects

Draft

Draft proposal for attribute effects beyond validation, provenance, and explicit metadata setters. V1 attributes are not macros.

Summary

Catalyst should eventually decide whether attributes can perform richer semantic effects than V1 allows.

V1 attributes may validate, emit diagnostics, store normalized metadata, and call explicit target setter APIs. They do not replace declarations or perform arbitrary semantic rewrites.

Example

Possible future shape:

@derive(Debug, Equality)
const Point = struct {
  x: f32
  y: f32
}

This would require attribute effects that request generated impls or declarations, which V1 intentionally does not allow.

Motivation

Richer effects could support domain-specific validation, generated support code, derived impls, or tool metadata. Without boundaries, attributes become macros by another name.

Proposed Direction

The proposal should cover:

  • which additional target metadata setters exist;
  • whether attributes can request generated declarations or impls;
  • ordering and conflict behavior for richer effects;
  • reflection of effect provenance;
  • diagnostics and tooling display;
  • boundaries that keep attributes inspectable.

V1 Compatibility

V1 attribute effects are limited to validation, provenance, and explicit metadata setters. Attribute-generated declarations or impls are tracked by CEP-0009.