aboutsummaryrefslogtreecommitdiffstats
path: root/alv/stream/base.moon
blob: 37cc8a4290a2a89d030b5fc928a152a2db92a717 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
----
-- base Stream interface.
--
-- implemented by `ValueStream`, `EventStream`, and `IOStream`.
--
-- @classmod Stream

class Stream
--- Stream interface.
--
-- Methods that have to be implemented by `Stream` implementations
-- (`ValueStream`, `EventStream`, `IOStream`).
--
-- @section interface

  --- return whether this Stream was changed in the current tick.
  --
  -- @function dirty
  -- @treturn boolean

  --- create a mutable copy of this Stream.
  --
  -- Used to insulate eval-cycles from each other.
  --
  -- @function fork
  -- @treturn Stream

  --- the type name of this Stream's value.
  --
  -- the following builtin typenames are used:
  --
  -- - `str` - strings, `value` is a Lua string
  -- - `sym` - symbols, `value` is a Lua string
  -- - `num` - numbers, `value` is a Lua number
  -- - `bool` - booleans, `value` is a Lua boolean
  -- - `bang` - trigger signals, `value` is a Lua boolean
  -- - `opdef` - `value` is an `Op` subclass
  -- - `builtin` - `value` is a `Builtin` subclass
  -- - `fndef` - `value` is a `FnDef` instance
  -- - `scope` - `value` is a `Scope` instance
  --
  -- @tfield string type

  --- documentation metadata.
  --
  -- an optional table containing metadata for error messages and
  -- documentation. The following keys are recognized:
  --
  -- - `name`: optional name
  -- - `summary`: single-line description (markdown)
  -- - `examples`: optional list of single-line code examples
  -- - `description`: optional full-text description (markdown)
  --
  -- @tfield ?table meta

--- static functions
-- @section static

  --- construct a new Stream.
  --
  -- @classmethod
  -- @tparam string type the type name
  -- @tparam ?table meta the `meta` table
  new: (@type, @meta={}) =>

{
  :Stream
}