Let a validation rule name a predicate it cannot express - #49
Conversation
The declarative rule kinds are a closed set, so a rule whose logic is an arbitrary predicate had no shape at all and was left out of the document entirely. That does not just lose detail - it makes the document assert something false. A property with two declarative rules and three predicates reads as a property with two rules, and a reader cannot tell "nothing further constrains this" from "the rest could not be written down". 'rule <Name>' states that a constraint exists and what it is called. The name is a reference into the implementation, not a declared entity - nothing resolves it - and the rule carries 'message' like any other. A name that is not an identifier is an error rather than silently accepted.
|
Reviewer notes — open for review, not merged, since it is a language decision. Answering the three questions raised in #47: Should an unnamed predicate be expressible? No — Does it participate in anything? Purely descriptive, and the docs say so explicitly. The name is a reference into the implementation, not a declared entity — unlike Does the async variant need distinguishing? No. Flat, not nested. #47 sketched a nested form (property header, indented rules). I went flat — Independent of #45 and #48. Branched from Verification — |
|
Merge ordering note. This PR and #45 each merge cleanly into
Whichever lands second needs a small manual resolution. The resolution is additive in every case — the two features compose rather than compete, so #48 conflicts with neither and can land in any order. |
Added
rule <Name>as a validation rule kind, for a rule whose logic is an arbitrary predicate:orgNumber rule BeAValidOrganizationNumber message "Must be a valid organization number". It carriesmessagelike any other rule, and works on both command and concept validation. (No counterpart for a validation rule whose logic is an arbitrary predicate #47)Fixed