Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Consuming a vocabulary: imported checks run on your catalog

Area: Vocabulary & packages Teaches: the property that makes a vocabulary package real — when you import a vocabulary and declare concepts with its keywords, the vocabulary’s catalog checks run on your declarations at your own ox check/ox build. Cross-package static checking, for free. Prerequisites: the legal vocabulary package it imports. Run: ox build examples/legal_catalog_v0

legal_vocab_v0 ships deontic concepts, an introducer metatype obligation, and an OrphanObligationConcept check. This package imports the vocabulary, declares two norm concepts with its keyword, and the vocabulary’s check fires across the package boundary on this catalog — one well-formed, one orphan.

What to read in root.ar

Import the vocabulary’s keywords and concepts:

use legal_vocab_v0::{ obligation, party };
use legal_vocab_v0::{ LegalSubject, TimedObligation };

A well-formed norm anchors to the vocabulary’s root, so it inherits the deadline discipline and the check stays silent:

pub obligation PayRent <: TimedObligation { mut amount: Decimal }

An orphan norm anchors to nothing in the vocabulary — declared with the obligation keyword but specializing no norm root. This is exactly what OrphanObligationConcept is built to catch:

pub obligation Indemnify { mut scope: String }

Running it

ox build elaborates the two modules together and the vocabulary-shipped check fires on Indemnify (the orphan) while leaving PayRent (anchored) silent:

workspace: elaborated 2 module(s) into one artifact
UFOL::W002

  ⚠ UFOL::W002: an `obligation` concept does not specialize `TimedObligation`
  │ — anchor it so its deadline discipline is inherited [Indemnify]
  help: fired by check `legal_vocab_v0::OrphanObligationConcept`

The help: line names the check’s originating package — the diagnostic comes from the dependency, not from this file. The decisive contrast is PayRent vs Indemnify: both are declared with the imported obligation keyword, but only the orphan trips the imported audit. UFOL::W002 is a Warning, so the build succeeds (ox check --codes reports ok).

This example is compiled and run in CI; a corpus test (oxc-runtime/tests/examples_corpus.rs) pins the cross-package check behaviour, so the “imported checks run” property can’t drift from the language.

Source

The package’s real Argon source, transcluded from the file this corpus compiles — what you read here is exactly what CI builds.

//! `legal_catalog_v0` — the cross-package catalog-check proof for the deontic
//! vocabulary `legal_vocab_v0` (RFD 0030; GO-journey (a)). It imports the
//! vocabulary and declares a WELL-FORMED norm concept and an ORPHAN one, so the
//! vocabulary-SHIPPED `OrphanObligationConcept` catalog check fires on THIS
//! consumer's catalog at the consumer's `ox check` — the property that makes a
//! vocabulary package real: imported checks run.
//!
//! This consumer carries NO defeasibility plane, so the check-discharge gate
//! (the wall documented in `legal_obligations_v0`) does not apply: the
//! vocabulary's checks and this catalog co-exist. The served flagship model
//! (`legal_obligations_v0`) carries the defeasible/temporal/derived/HTTP half
//! against the same vocabulary; the two halves are split by that gate.
//!
//! Mirrors the `vocab_consumer_v0` / `vocab_pkg_v0` pattern, lifted to the
//! legal-deontic vocabulary.

use legal_vocab_v0::{ obligation, party };
use legal_vocab_v0::{ LegalSubject, TimedObligation };

// A party declared with the imported `party` introducer.
pub party Tenant <: LegalSubject {
    name: String,
}

// WELL-FORMED: a norm concept declared with the imported `obligation` keyword
// that anchors to the vocabulary's `TimedObligation` root — so it inherits the
// deadline discipline and the `OrphanObligationConcept` check does NOT fire.
pub obligation PayRent <: TimedObligation {
    mut amount: Decimal,
}

// ORPHAN: a norm concept declared with the imported `obligation` keyword that
// does NOT specialize `TimedObligation`. The vocabulary-shipped
// `OrphanObligationConcept` catalog check FIRES on this declaration
// (Warning UFOL::W002) at THIS consumer's `ox check`.
pub obligation Indemnify {
    mut scope: String,
}