Back to Blog

RIDDL 2.8.0 Released

RIDDL 2.8.0 is now available.

release riddl compiler

RIDDL 2.8.0 is now available. This release of the RIDDL compiler and language tooling includes the following changes:

What’s New

What’s New

riddl 2.8.0 adds recurrence and calendar scheduling, five new value forms, ask with arguments, and an on init that means creation. It also tightens a dozen checks that had been silent, and it is binary compatible with 2.7.0 (MiMa clean on all six modules).

Regenerate .bast files: FORMAT_REVISION moved from 31 to 37, so a 2.7.0 .bast file will not load.

Features

  • Recurrence. send <msg> to <outlet> every <period> [starting [at] <instant>] registers a recurring send and is legal only in on init. on every <period> is { … } is a handler clause that fires every period. A re-emission scheduled at <instant> + <duration> is also recognised as a recurrence rather than an infinite message loop (stream-graph-cycle).

  • Calendar and cron schedules. A period can be a calendar schedule:

    • every month on day 1 at 09:00
    • every month on last day
    • every month on the third wednesday
    • every 3 months on day 1
    • every year on march 31
    • every year on the first monday of september
    • every day at 06:00, every weekday at 08:30
    • every monday, wednesday and friday
    • the escape hatch every cron "0 9 1 * *"

    An optional in "<zone>" names the time zone, and UTC is the default. A month that lacks the named day is skipped, with an Advisory recommending on last day for month-end. Malformed days, times, intervals, duplicate weekdays, dates that never exist, cron expressions and zones are Errors.

  • Calendar-period arithmetic. date + 1 month, t - 2 years + 3 days. It applies to Date, DateTime, ZonedDateTime and TimeStamp, and clamps at month-end (Jan 31 + 1 month = Feb 28/29).

  • on init is creation. One per entity, at entity level, it runs once at create and morphs into the starting state, chosen from its parameters. There is no “initial state” any more. An entity that starts by declaration order draws a deprecation (entity-init-no-morph, removed in 3.0).

  • on entry. A state’s entry action. It runs on a live morph into that state, but never at creation, replay or rehydration.

  • Value forms:

    • <unit> of d, a Duration in whole units
    • sum of xs [as e by <expr>]
    • one of xs as e where p
    • x otherwise y, a default for an optional value
    • when c then a else b end as a value
    • optional chaining through a T? field in a value path
  • ask query Q(f = v) of P. An ask now constructs its query, as send and tell always could.

  • riddlc find -type accepts the new value kinds.

Validation: new and tightened checks

  • Literals are held to their position’s type. A written number is refused where a DateTime, String, record or Currency is declared, and a numeric field’s range applies (-3 for a Natural). A string for a Date, DateTime or TimeStamp must be ISO-8601.
  • Booleans and numbers. A Boolean fills an Integer (true = 1, false = 0), and the literals 0 and 1 fill a Boolean. Any other number there is refused.
  • Optional into required (value-optional-for-required). This new Advisory flags a T?, T* or T{0,n} value given where one is required. A guard the model states silences it:
    • inside when x != empty then, and the else of when x == empty;
    • for each conjunct of an and;
    • for every statement after require x != empty, or after an early-exit when x == empty then error.
  • call, create and terminate arguments are type-checked exactly like constructor arguments. Until now only an aliased parameter type was checked.
  • A value reference must name a value (value-ref-not-a-value). A bare name no longer silently binds to a state, an entity or another non-value definition.
  • A processor reference’s keyword must match its target (ref-wrong-keyword). For example, tell … to repository F where F is a streamlet is now an Error.
  • Undeliverable clauses and unused outlets. Two Completeness warnings report an on clause nothing can deliver to and an outlet nothing is ever sent on. They account for relays, correlations and asked queries.
  • Opacity is one rule. A handler-less Context or Projector is judged literally on both its send and its receive side.
  • Entity handler reporting. An entity with no handlers is reported once, as a Completeness warning (entity-no-handlers), instead of also as an Error. An FSM that never transitions has its own code, entity-fsm-no-transitions, and the check now sees a morph written inside a state’s handler.
  • Two rule ids that were defined but never emitted now fire: repo-link-type-mismatch and value-membership-type-mismatch.
  • Saga steps see the saga’s requires input, as a function body sees its own.
  • Deprecations last until the next major release. Deprecated spellings parse through 2.x and may be removed in 3.0. Messages now say so.

Bug Fixes

  • Validate crash on a record with a method. Passing a value whose record declares a method as an argument threw a location-less ClassCastException. It no longer crashes.
  • In-pass exceptions are located. An exception inside a pass is now reported at the node that threw, instead of at empty(1:1).
  • Misspelled path through a let. A misspelled field in a path read through a let validated clean; the path is now walked to its end.
  • Prettify fixes:
    • Currency(USD) and the zoned date/time types now round-trip; ZonedDate rendered as ZonedDateTime.
    • Every definition starts on its own line; four leaf kinds ran into the next definition.
    • A function’s ??? body is kept.
    • B5 quantifiers and filters are parenthesized when used as operands.
  • option external on a Domain. The deprecation now names a fix a domain can actually take.
  • stmt-yield-argument-prompt no longer fires inside an external context.

Internal

  • Binary compatibility with 2.7.0 is restored and checked with MiMa. The recurrence fields carry old-shape shims (SendStatement, SendStmtDto, OnClauseDto), recorded for removal in 3.0.
  • riddl-examples is retired; its FooBar models live on as fixtures in language/input/foobar/.