Skip to content

Release 2.8.3

Choose a tag to compare

@reid-spencer reid-spencer released this 22 Nov 18:28
· 12 commits to main since this release

What's New

Features

  • Collection map: each of <coll> as <e> [where <p>] yielding <value> —
    The language can now reshape a collection, not just filter it. Each element
    that passes the optional where filter is bound to <e>, and the projection
    is computed for it. The projection may be any value expression: a field, an
    arithmetic expression, a record constructor and so on. This replaces the
    prompt that was the only way to write, for example, an entity built from
    the filtered and reshaped lines of a message.
    • Typing: the result is a collection of the projection's type. Without a
      filter it keeps the source's cardinality: T+ gives U+, and anything
      else gives U*. A filter lowers the minimum to zero, so a filtered map
      that fills a T+ draws the existing optional-for-required Advisory.
    • Checks: the element is in scope only in the filter and the projection.
      The source must be a collection and the filter must be boolean.
    • Reserved words: neither each nor yielding is reserved.
    • Computational Model: B5 now records what a generator must preserve:
      the source order, one result per admitted element, the filter applied
      before the projection, and per-element effects in order.
  • msg-answer-unreachable (Completeness) — reported for a send or
    tell of a command that yields, or a query that replies, when no route
    carries the answer back to an inlet of the sender that admits it. The route
    check is type-aware: a path that exists but cannot carry the answer type does
    not count.
  • stmt-send-duplicates-yield (Style) — reported for a send that
    publishes the same value on an outlet the sibling yield or reply already
    publishes on, which puts a second copy on that outlet. This follows CM §20.4,
    which now states that a yield or reply is published on every outlet of its
    processor that admits its type.

Bug Fixes

  • Prettify of keyword-led operands — prettify wrote
    any of (query T) as r where p as any of query T as r where p, which does
    not parse. query, prompt, call, ask, create and constructors used
    as the operand of an operator now always keep their parentheses. No canonical
    form changes, since none of these operands could parse without parentheses
    before.

Internal

  • BAST FORMAT_REVISION is now 38, for the collection map (value tag 30).
    Readers reject .bast files written at an older revision, so regenerate
    them with this riddlc.
  • JSON: the collection map is written as "value": "map", with
    collection, element, an optional filter, and projection.
  • The EBNF grammar, Finder, find kinds (collection-map) and JSON_COVERAGE.md
    are updated to match.
  • Known gap: a T{n,m} range type has no source spelling, because no
    parser rule builds one, so it is reachable only from BAST or JSON. Whether to
    add syntax for it or correct the documentation is still open.