-
Notifications
You must be signed in to change notification settings - Fork 0
/
bindings.yaml
62 lines (48 loc) · 2.45 KB
/
bindings.yaml
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
slug: bindings
see:
- label: Observers
href: ./observers.yaml
- label: Module System
href: ./system.yaml
--- |
# [Bindings][FRB]
Within the memory of one process running on an event loop, it is always
possible to have a consistent model at the end of every event.
There is no value in the compromise of eventual consistency unless state is
spread across multiple processes.
As such, bindings should be implemented like a Prolog, guaranteeing consistency
at the conclusion of every state change.
This means effecting changes recursively and synchronously.
…And leave the DOM out of this.
The DOM is slow because it thrashes on reads and writes.
Using [Blick][] and similar draw cycle tools, it is possible to batch reads and
writes for each animation frame.
[Blick]: https://github.com/gutentags/blick
Property and content change observers are the primitive from which we can build
synchronous data bindings.
[Functional Reactive Bindings][FRB] is a language and runtime for effecting one
and two-way bindings based on stacked change observers.
[FRB]: https://github.com/montagejs/frb
FRB is based on Version 1 of [Collections][Collections1], which is tightly
coupled to certain global shims and comes with an older change listener
interface, from which [POP Observe][] improves upon based on observations about
how FRB composes them, with a focus on avoiding closures and reusing observer
objects.
[Collections1]: https://github.com/montagejs/collections
[POP Observe]: https://github.com/kriskowal/pop-iterator
Developing FRB for Montage led me to conclude that bindings should be expressed
in a way similar to CSS.
There should be a language that applies blocks of bindings to components based
on their identifier.
FRB also comes with a complete runtime for all possible expressions and
operators that the language supports.
The next rendition of reactive bindings would benefit from a JavaScript
translator that only links the change operators, like `map` or `filter`, that
an application needs.
The [System Modules][] package provides an opportunity to hook arbitary
languages, load dependencies, and translate them to JavaScript.
The next generation of FRB would compile a CSS-alike language to bindings.
Although bindings apply largely to properties of components, it would also be
possible to use bindings to manipulate style directly, possibly driving
a CSSOM runtime, scoping style changes to an instance of a component.
[System Modules]: https://github.com/gutentags/system