Repository navigation
Release 2.8.0
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 inon 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:00every month on last dayevery month on the third wednesdayevery 3 months on day 1every year on march 31every year on the first monday of septemberevery day at 06:00,every weekday at 08:30every 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 recommendingon last dayfor 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,ZonedDateTimeandTimeStamp, and clamps at month-end
(Jan 31 + 1 month = Feb 28/29). -
on initis creation. One per entity, at entity level, it runs once atcreateand
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 livemorphinto that state, but
never at creation, replay or rehydration. -
Value forms:
<unit> of d, a Duration in whole unitssum of xs [as e by <expr>]one of xs as e where px otherwise y, a default for an optional valuewhen c then a else b endas a value- optional chaining through a
T?field in a value path
-
ask query Q(f = v) of P. Anasknow constructs its query, assendandtell
always could. -
riddlc find -typeaccepts 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 orCurrencyis declared, and a numeric field's range
applies (-3for aNatural). A string for aDate,DateTimeorTimeStampmust
be ISO-8601. - Booleans and numbers. A Boolean fills an
Integer(true= 1,false= 0), and
the literals0and1fill aBoolean. Any other number there is refused. - Optional into required (
value-optional-for-required). This new Advisory flags a
T?,T*orT{0,n}value given where one is required. A guard the model states
silences it:- inside
when x != empty then, and theelseofwhen 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.
- inside
call,createandterminatearguments 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 FwhereFis 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 amorphwritten inside a state's handler. - Two rule ids that were defined but never emitted now fire:
repo-link-type-mismatchandvalue-membership-type-mismatch. - Saga steps see the saga's
requiresinput, 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-lessClassCastException. It no longer crashes. - In-pass exceptions are located. An exception inside a pass is now reported at the
node that threw, instead of atempty(1:1). - Misspelled path through a
let. A misspelled field in a path read through alet
validated clean; the path is now walked to its end. - Prettify fixes:
Currency(USD)and the zoned date/time types now round-trip;ZonedDaterendered 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 externalon a Domain. The deprecation now names a fix a domain can
actually take.stmt-yield-argument-promptno 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/.