on master help sign in
"gall" to "Gall", included link to original spec.
c5f892aFang
docs/talk/gall-spec_orig.hoonnew file+149
@@ -0,0 +1,149 @@
1+=> |%
2+ --
3+|* $: :> vinyl: historical state (including version)
4+ :> brain: working state of the application (not including version)
5+ :> delta: grain of change across all state
6+ :> prize: (pair mark noun) for namespace value
7+ :> rumor: (pair mark noun) for namespace diff
8+ :> opera: (pair bone card) for operation (old ++move)
9+ :>
10+ vinyl/mold
11+ brain/mold
12+ delta/mold
13+ prize/mold
14+ rumor/mold
15+ opera/mold
16+ ==
17+|_ $: :> ops: pending operations, in reverse order
18+ :> ego: current state
19+ :>
20+ ops/(list opera)
21+ ego/brain
22+ ==
23+:: :: ++bake
24+++ bake :< apply delta
25+ |= $: :> del: change
26+ :>
27+ del/delta
28+ ==
29+ :> core after change (including operations)
30+ ^- _+>
31+ !!
32+:: :: ++cope
33+++ cope :< transaction result
34+ |= $: :> weg: forward identity
35+ :> het: success or error report
36+ :>
37+ weg/(list coin)
38+ het/(unit tang)
39+ ==
40+ :> actions in reverse order
41+ :>
42+ ^- (list delta)
43+ !!
44+:: :: ++fail
45+++ fail :< process error
46+ |= $: :> why: error dump
47+ :>
48+ why/tang
49+ ==
50+ :> actions in reverse order
51+ :>
52+ ^- (list delta)
53+ !!
54+:: :: ++feel
55+++ feel :< update
56+ |= $: :> del: change
57+ :> pex: preparsed path, inside-first
58+ :>
59+ del/delta
60+ pex/(list coin)
61+ ==
62+ :> query updates in reverse order
63+ :>
64+ ^- (list rumor)
65+ !!
66+:: :: ++hear
67+++ hear :< subscription update
68+ |= $: :> weg: forward identity
69+ :>
70+ weg/(list coin)
71+ ==
72+ :> actions in reverse order
73+ :>
74+ ^- (list delta)
75+ !!
76+:: :: ++pull
77+++ pull :< subscription cancel
78+ |= $: :> weg: forward identity
79+ :> het: error report, if any
80+ :>
81+ weg/(list coin)
82+ het/(unit tang)
83+ ==
84+ :> actions in reverse order
85+ :>
86+ ^- (list delta)
87+ !!
88+:: :: ++leak
89+++ leak :< check access
90+ |= $: :> lec: leakset (~ means public)
91+ :> pex: preparsed path, inside-first
92+ :>
93+ lec/(unit (set ship))
94+ pex/(list coin)
95+ ==
96+ :> if path `pex` is visible to ships in `lec`
97+ ^- ?
98+ !!
99+:: :: ++load
100+++ look :< asynchronous read
101+ |= $: :> pex: preparsed path, inside-first
102+ :>
103+ pex/(list coin)
104+ ==
105+ :> actions in reverse order
106+ ^- _+>
107+ !!
108+:: :: ++prep
109+++ prep :< load system
110+ |= $: old/vinyl
111+ ==
112+ :> core after boot
113+ ^- _+>
114+ !!
115+:: :: ++peek
116+++ peek :< synchronous read
117+ |= $: :> pex: preparsed path, inside-first
118+ :>
119+ pex/(list coin)
120+ ==
121+ :> value at `pec`; ~ for unavailable, [~ ~] for invalid
122+ :>
123+ ^- (unit (unit prize))
124+ !!
125+:: :: ++poke
126+++ poke :< generic poke
127+ |= $: :> ost: opaque cause
128+ :> msg: message with mark and vase
129+ :>
130+ ost/bone
131+ msg/cage
132+ ==
133+ :> actions in reverse order
134+ :>
135+ ^- (list delta)
136+ !!
137+:: :: ++pour
138+++ pour :< arvo response
139+ |= $: :> weg: forward identity
140+ :> sin: response card
141+ :>
142+ weg/(list coin)
143+ sin/sign
144+ ==
145+ :> actions in reverse order
146+ :>
147+ ^- (list delta)
148+ !!
149+--
docs/talk/gall.md+21−21
@@ -1,9 +1,9 @@
1
1
2# The new Gall model
2# The new Gall model
3
3
4−This document is complemented by the source code of applications that use the new gall model (like hall), but doesn't require it. Code snippets and diagrams will be provided where useful. Some knowledge of Hoon and the functioning of Hoon apps is assumed.
4+This document is complemented by the source code of applications that use the new Gall model (like hall), but doesn't require it. Code snippets and diagrams will be provided where useful. Some knowledge of Hoon and the functioning of Hoon apps is assumed.
5
5
6−New gall has not yet fully solidified. As such, structure and naming are tentative to change.
6+New Gall has not yet fully solidified. As such, structure and naming are tentative to change.
7
7
8## Table of contents
8## Table of contents
9
9
@@ -11,7 +11,7 @@ New gall has not yet fully solidified. As such, structure and naming are tentati
11
11
12## Renewing a pillar of Arvo
12## Renewing a pillar of Arvo
13
13
14−When you write an app, gall is responsible for making sure its event arms like `++poke` get called when they need to. In essence, it provides developers with a consistent interface for hooking their app up to the operating system.
14+When you write an app, Gall is responsible for making sure its event arms like `++poke` get called when they need to. In essence, it provides developers with a consistent interface for hooking their app up to the operating system.
15It's not doing a lot to make sure this is done in a structured way though, which results in apps (especially larger ones) feeling like big tangled messes. Something needs to be done about this.
15It's not doing a lot to make sure this is done in a structured way though, which results in apps (especially larger ones) feeling like big tangled messes. Something needs to be done about this.
16
16
17### Problems
17### Problems
@@ -33,23 +33,23 @@ cost is extremely welcome.
33
33
34### Solutions
34### Solutions
35
35
36−Let's imagine a world in which gall *does* help, in both those places.
36+Let's imagine a world in which Gall *does* help, in both those places.
37
37
38−It would be wonderful if gall could take care of all standard subscription management logic for you, and direct the flow of code as it concludes is appropriate.
38+It would be wonderful if Gall could take care of all standard subscription management logic for you, and direct the flow of code as it concludes is appropriate.
39−Applications, then, would have to help gall by providing the different parts of this flow, and the checks that allow gall to make the right decisions. This takes some work out of the developer's hands and results in more structured application code.
39+Applications, then, would have to help Gall by providing the different parts of this flow, and the checks that allow Gall to make the right decisions. This takes some work out of the developer's hands and results in more structured application code.
40
40
41−If we expand on that a bit we can even have gall help us in untangling state changes from side effects. We do so by separating state changes into two phases: *analyzing* what changes need to be made, and *applying* those changes.
41+If we expand on that a bit we can even have Gall help us in untangling state changes from side effects. We do so by separating state changes into two phases: *analyzing* what changes need to be made, and *applying* those changes.
42−But where do the side-effects go then? We need to realize there's two kinds: side-effects that are subscription updates, and those that aren't. The latter get produces by applying state changes, while the former get integrated into the gall flow we described above.
42+But where do the side-effects go then? We need to realize there's two kinds: side-effects that are subscription updates, and those that aren't. The latter get produces by applying state changes, while the former get integrated into the Gall flow we described above.
43−Since subscriptions are essentially queries to an app, requesting a specific part of its data/state, we can deduce subscription updates from state changes. We merely provide the logic, and gall chains it all together.
43+Since subscriptions are essentially queries to an app, requesting a specific part of its data/state, we can deduce subscription updates from state changes. We merely provide the logic, and Gall chains it all together.
44
44
45−Having gall support all this allows us to cleanly and structurally untangle state change analysis, application, and subscription logic into their own arms.
45+Having Gall support all this allows us to cleanly and structurally untangle state change analysis, application, and subscription logic into their own arms.
46For trivial apps, this might result in some arms with trivial code. Though it may feel like writing cruft, it makes understanding the app just as simple as it actually as.
46For trivial apps, this might result in some arms with trivial code. Though it may feel like writing cruft, it makes understanding the app just as simple as it actually as.
47For more complex apps, all logic is no longer a big chunk of "what do we do when x happens?", but rather a couple of smaller chunks, like "x happened, how does that change our state?" and "if our state changes like y, what does that mean for subscription z?" These are precisely the kinds of questions that application developers should be asked.
47For more complex apps, all logic is no longer a big chunk of "what do we do when x happens?", but rather a couple of smaller chunks, like "x happened, how does that change our state?" and "if our state changes like y, what does that mean for subscription z?" These are precisely the kinds of questions that application developers should be asked.
48
48
49
49
50−## As seen in new gall
50+## As seen in new Gall
51
51
52−Of course for the above to be made into reality, gall will need to see some changes. Let's outline the new structures and the arms they get passed between.
52+Of course for the above to be made into reality, Gall will need to see some changes. Let's outline the new structures and the arms they get passed between.
53
53
54### Structures
54### Structures
55
55
@@ -79,12 +79,12 @@ This also wouldn't be Urbit if we couldn't boil that down to a few simple pseudo
79 (gain rumor:(feel query delta) prize:(peek brain query))
79 (gain rumor:(feel query delta) prize:(peek brain query))
80```
80```
81
81
82−There, in the first three arms we already have the bulk of new gall! `++gain` won't be part of it, since most applications don't need to keep track of `prize`s directly. Those that do may still implement and hook it up themselves though.
82+There, in the first three arms we already have the bulk of new Gall! `++gain` won't be part of it, since most applications don't need to keep track of `prize`s directly. Those that do may still implement and hook it up themselves though.
83
83
84−Of course, these aren't all of the new gall arms. Most important to still mention is `++leak`, which takes a `ship` and `query` and checks if the former has permission to ask for the latter.
84+Of course, these aren't all of the new Gall arms. Most important to still mention is `++leak`, which takes a `ship` and `query` and checks if the former has permission to ask for the latter.
85There's also `++look` for asynchronous reads, `++hear` for subscription updates (rumors), `++fail` for dealing with process errors, `++cope` for dealing with transaction results, and `++pour` for dealing with responses from arvo.
85There's also `++look` for asynchronous reads, `++hear` for subscription updates (rumors), `++fail` for dealing with process errors, `++cope` for dealing with transaction results, and `++pour` for dealing with responses from arvo.
86`++prep`, `++poke` and `++pull` continue to function as they do right now.
86`++prep`, `++poke` and `++pull` continue to function as they do right now.
87−For a more verbose specification of all of these, see the new gall spec.
87+For a more verbose specification of all of these, see the new Gall spec.
88
88
89
89
90## By example
90## By example
@@ -213,22 +213,22 @@ As we saw earlier, for `/number` queries the `delta`s match one-on-one with the
213
213
214## Criticism
214## Criticism
215
215
216−* Where event arms currently get passed a `wire`, and the new gall described above passes them a custom `query` structure, the original new gall spec gave them `(list coin)`, a "pre-parsed wire". These structures (eg `[%$ p=[p=~.ud q=123]]`) are uncomfortable to work with. Even with a "coin list parsing library" it still doesn't feel ideal.
216+* Where event arms currently get passed a `wire`, and the new Gall described above passes them a custom `query` structure, the original new Gall spec gave them `(list coin)`, a "pre-parsed wire". These structures (eg `[%$ p=[p=~.ud q=123]]`) are uncomfortable to work with. Even with a "coin list parsing library" it still doesn't feel ideal.
217Because of custom structures being easier to work with than lists of knots or coins, writing a `++path-to-query` arm by hand is a small cost for huge gains.
217Because of custom structures being easier to work with than lists of knots or coins, writing a `++path-to-query` arm by hand is a small cost for huge gains.
218
218
219* Why do `prize` units mean what they do? Would have expected `~` to mean "invalid" and `[~ ~]` to mean "unavailable" as opposed to the other way around.
219* Why do `prize` units mean what they do? Would have expected `~` to mean "invalid" and `[~ ~]` to mean "unavailable" as opposed to the other way around.
220
220
221−* The original new gall spec mentions output lists (like `(list delta)` etc.) to be in reverse order. This was done because adding to the head of a list (`[item list]`) is easier than appending to the tail of a list (`(weld list [item ~])` or other).
221+* The original new Gall spec mentions output lists (like `(list delta)` etc.) to be in reverse order. This was done because adding to the head of a list (`[item list]`) is easier than appending to the tail of a list (`(weld list [item ~])` or other).
222While it's technically easier to produce a list in reverse order, semantically it's yet another thing to keep in mind. Luckily, most of the "add to x, produce all of it later" code is set-and-forget, so probably not a huge deal, but do we really fear a few stray `++flop`s that much?
222While it's technically easier to produce a list in reverse order, semantically it's yet another thing to keep in mind. Luckily, most of the "add to x, produce all of it later" code is set-and-forget, so probably not a huge deal, but do we really fear a few stray `++flop`s that much?
223
223
224−* There's some weirdness with relation to relying on old state in `++feel` to determine whether a query result actually changed. Just relying on state in general for delta-to-rumor conversion may or may not violate the new gall spec.
224+* There's some weirdness with relation to relying on old state in `++feel` to determine whether a query result actually changed. Just relying on state in general for delta-to-rumor conversion may or may not violate the new Gall spec.
225
225
226−* The original new gall spec specifies `++leak` as taking a `(unit (set ship))`, where `~` means public. Is there a use case for checking more than just a single ship?
226+* The original new Gall spec specifies `++leak` as taking a `(unit (set ship))`, where `~` means public. Is there a use case for checking more than just a single ship?
227
227
228* Gall should probably cache `++feel` results during a single pass, to avoid the cycles of generating what it can be certain of is the same `(unit rumor)`. (But then for eg `/circle/nom/13` and `/circle/nom/14` it would still recalculate. Better than nothing.)
228* Gall should probably cache `++feel` results during a single pass, to avoid the cycles of generating what it can be certain of is the same `(unit rumor)`. (But then for eg `/circle/nom/13` and `/circle/nom/14` it would still recalculate. Better than nothing.)
229
229
230
230
231## Further reading
231## Further reading
232
232
233−@TODO original gall-spec.hoon / heed.hoon
233+[Original new gall spec by ~sorreg-namtyv](gall-spec_orig.hoon)
234−@TODO proposed gall-spec.hoon / heed.hoon
234+@TODO proposed gall-spec.hoon