ocaml-rego: evaluator semantics, destructuring, and OPA builtins
Core semantics:
- structural unification now destructures arrays/objects against bound
values, and exposes [bind_value_pattern] for matching AST patterns
against concrete [Value.t]s.
- function-rule parameters are unified with [bind_value_pattern], so
literal patterns ([multi(1, x)], [arrays([a, b])], [objects({...})])
match by value; function rules with [default] fall back when no spec
matches; body-less function rules return the head value directly.
- the call output-arg form destructures [Array]/[Object] patterns at
the result position, so [split(s, sep, [x])] binds [x] correctly.
- [Membership] is evaluated by walking the collection and pairing
values with their indices/keys for the [k, v in c] form.
- [object.remove] accepts object/set/array key collections and errors
on non-object subjects; [array.flatten]/[array.concat]/[array.reverse]
reject non-array inputs.
New builtins (with the helpers they need at file scope):
- glob.match / glob.quote_meta with a backtracking matcher honouring
`**` and the `[a-z]` character classes.
- units.parse and units.parse_bytes with case-insensitive binary
suffixes and quote stripping; [m] vs [M] disambiguates milli/mega.
- time.now_ns, time.parse_duration_ns, time.parse_rfc3339_ns,
time.parse_ns, time.date, time.clock, time.weekday, time.add_date,
time.diff. Calendar math uses [days_from_civil] (Howard Hinnant)
instead of [Unix.mktime] to stay timezone-independent. Adds [unix]
to the library's deps.
- net.cidr_contains parsing IPv4 and IPv6 (mapped through v4-in-v6).
- json.filter, json.remove, json.patch (RFC 6902: add/replace/remove/
move/copy/test) with a JSON-pointer parser.
- strings.any_prefix_match, strings.any_suffix_match, strings.count,
strings.reverse (UTF-8 code-point reversal), indexof_n, format_int.
- substring indexes by UTF-8 code points and rejects negative offsets.