Understanding the Why

... why English is a bad programming language

5.1 Why Type Safety Matters for Law

The Problem: Legal drafting often suffers from ambiguity and inconsistency.

Example ambiguity:

"The charity must notify the person responsible within 30 days."

Questions arise:

  • Which person? The governor? The secretary? The Commissioner?

  • 30 days from what event?

  • What form should the notification take?

L4's type safety prevents these problems:

DECLARE NotificationTarget IS ONE OF
    Governor HAS name IS A STRING
    Commissioner
    Secretary HAS name IS A STRING

DECLARE NotificationEvent IS ONE OF  
    GovernorAppointment HAS date IS A Date
    ConvictionReported HAS convictionDate IS A Date
    AddressChange HAS changeDate IS A Date

DECLARE Actor IS ONE OF
    CharityActor HAS charity IS A RegisteredCharity

DECLARE Action IS ONE OF
    NotifyPerson HAS target IS A NotificationTarget
                     content IS A STRING

GIVEN charity IS A RegisteredCharity
      notificationContent IS A STRING
      event IS A NotificationEvent
GIVETH A CONTRACT Actor Action
`notification obligation` MEANS
  PARTY CharityActor charity
  MUST NotifyPerson Commissioner notificationContent
  WITHIN 30  -- days from event date
  HENCE FULFILLED
  LEST FULFILLED

Benefits:

  • Eliminates ambiguity: Exactly which person, exactly which event

  • Prevents inconsistency: Can't accidentally use wrong notification type

  • Enables automation: Computer can check compliance automatically

5.2 Why CONTRACT Over Simple Rules

Traditional legal drafting: Each section states an isolated obligation.

Problem: Real legal processes are interconnected workflows, not isolated duties.

Example - Annual Return Process:

  • Art 13(7): Charity must file return

  • Art 13(8): Commissioner must publish data

  • Art 27(1): Commissioner may issue Required Steps Notice for non-compliance

  • Art 16(1): Commissioner may deregister for continued non-compliance

These are connected steps in a process, not separate obligations.

CONTRACT approach captures the connections:

§DECLARE Actor IS ONE OF
    CharityActor HAS charity IS A RegisteredCharity
    CommissionerActor

DECLARE Action IS ONE OF
    FileReturn HAS financials IS A STRING
    PublishData HAS data IS A STRING
    IssueRequiredStepsNotice HAS steps IS A STRING
    InitiateDeregistration HAS grounds IS A STRING

GIVEN charity IS A RegisteredCharity
GIVETH A CONTRACT Actor Action
`annual return workflow` MEANS
  PARTY CharityActor charity
  MUST FileReturn "financial data"
  WITHIN 60  -- 2 months
  HENCE FULFILLED  -- Commissioner publishes data AND compliance maintained
  LEST FULFILLED   -- Commissioner empowered to issue Required Steps Notice

Benefits:

  • Captures legal reality: Shows how legal processes actually work

  • Enables simulation: Can test complete workflows, not just isolated rules

  • Supports drafting: Reveals gaps and inconsistencies in legal design

5.3 Why Modular Architecture Works

Legal reality: Modern regulation involves primary law + multiple subsidiary instruments.

Jersey Charities Example:

  • Primary Law: Charities (Jersey) Law 2014

  • Core Financial Info Regs 2018: Defines financial reporting requirements

  • Additional Info Order 2018: Adds governor payment reporting

  • Timing Order 2019: Sets annual return deadlines

  • Reasons and Time Limits Order 2020: Appeals procedures

L4 modular approach:

-- Main legislation file  
IMPORT prelude
-- IMPORT `charities-types`     -- Shared definitions (when modules are available)
-- IMPORT `annual-returns`      -- Specific processes (when modules are available)

-- For now, define everything in one file:
DECLARE RegisteredCharity
    HAS name IS A STRING
        registrationNumber IS A STRING
        -- other fields

DECLARE FinancialData
    HAS coreInfo IS A STRING
        governorPayments IS A STRING
        publicBenefitNarrative IS A STRING

-- Annual Return Process (integrating multiple orders)
GIVEN charity IS A RegisteredCharity
GIVETH A CONTRACT Actor Action
`comprehensive annual return` MEANS
  PARTY CharityActor charity
  MUST FileReturn "integrated financial data"  -- All 4 instruments
  WITHIN 60  -- Timing Order 2019: 2 months
  HENCE FULFILLED  -- Full transparency achieved (Purpose of Art 13 Law 2014)
  LEST FULFILLED   -- Late flag set + Required Steps Notice enabled

Benefits:

  • Mirrors legal structure: Matches how law is actually organized

  • Supports collaboration: Different teams can work on different modules

  • Enables updates: Can amend subsidiary regulations without changing primary law

  • Reduces complexity: Each file focuses on its specific domain

5.4 Common Patterns in Regulatory Law

Recognition Patterns (registration, licensing):

  • Application → Assessment → Decision → Registration → Ongoing compliance

Ongoing Compliance Patterns (reporting, inspection):

  • Periodic obligations → Monitoring → Non-compliance → Enforcement → Resolution

Enforcement Patterns (sanctions, appeals):

  • Detection → Investigation → Decision → Sanction → Appeal → Final resolution

These patterns appear across different regulatory domains (charities, financial services, professional regulation, etc.)

L4 captures these patterns consistently:

-- Generic enforcement pattern
DECLARE EnforcementAction IS ONE OF
    Warning HAS issueDate IS A Date
    Fine HAS amount IS A Money
    Suspension HAS period IS A Duration  
    Revocation HAS effectiveDate IS A Date

Last updated