[0.37.0] - Feb 15, 2021
Language improvements
-
Enable pattern matching in
for
loops andFlatMap
. One can now write:for ((k,v) in map) {}
instead of
for ((kv in map) { var k = kv.0}
and
(var x, var y) = FlatMap(expr)
instead of:
var xy = FlatMap(expr), var x = xy.0
-
Remove the hardwired knowledge about iterable types from the compiler.
Until now the compiler only knew how to iterate overVec
,Set
,
Map
,Group
, andTinySet
types. Instead we now allow the programmer
to label any extern type as iterable, meaning that it implementsiter()
andinto_iter()
methods, that return Rust iterators using one of two
attributes:#[iterate_by_ref=iter:<type>]
or
#[iterate_by_val=iter:<type>]
where
type
is the type yielded by thenext()
method of the iterator
The former indicates that theiter()
method returns a by-reference
iterator, the latter indicates thatiter()
returns a by-value
iterator.As a side effect of this change, the compiler no longer distinguishes
maps from other cotnainers that over 2-tuples. Therefore maps are
represented as lists of tuples in the Flatbuf-based Java API. -
Groups now iterate with weight. Internally, all DDlog relations are
multisets, where each element has a weight associated with it. We change
the semantics of groups to expose these weights during iteration.
Specifically, when iterating over a group in a for-loop or flattening it
withFlatMap
, each value in the iterator is a(v, w)
tuple, wherew
is the weight of elementv
.We keep the semantics of all existing library aggregates unchanged,
i.e., they ignore weights during iteration. This means that most existing
user code is not affected (custom aggregates are not that common). -
The
group_by
operator now works on streams and produces a stream of groups,
one for each individual transaction.
(Tutorial section) -
Two new DDlog operators: delay and differentiation. The former refers
to the contents of a relation fromN
transactions ago, whereN
is a positive
integer constant. The latter converts a stream into a relation that contains new
values added to the stream byt the last transaction.
(Tutorial section)