Skip to main content

Module pattern

Module pattern 

Source
Expand description

Resource patterns, and what one pattern says about another.

A grant’s resource is a pattern over concrete resources: /src/** stands for every path under /src. Deciding Law I means deciding questions about those sets — does this pattern cover that one, could these two ever touch the same thing — without enumerating them.

§The decidable fragment

A richer pattern language is easy to write and impossible to decide: two regex-ish patterns can overlap in ways no solver settles cheaply. Goal G5 says conservative by default, so this module supports a fragment it can decide exactly, and answers Tri::Unknown for everything else. The compiler turns Unknown into a rejection (US-0206), so an undecidable pattern costs you a build error, never a false guarantee.

Inside the fragment:

FormMeaning
srca literal segment
*exactly one segment, as a whole
**zero or more segments, final position only

Outside it, and therefore Unknown: ** anywhere but last, partial-segment globs like *.rs, and {template} segments, which are symbolic until the runtime clamps them.

Structs§

Pattern
A parsed resource pattern.

Enums§

Tri
A three-valued answer.
Undecidable
Why a pattern falls outside the decidable fragment.

Functions§

covers
Whether every resource matched by inner is also matched by outer.
intersect
The exact intersection of two patterns, if the fragment can express it.
overlaps
Whether two patterns could ever match the same concrete resource.