on master help sign in
cleaned up the entire Hall section. Mostly style/clarity edits.

fixed federation title fixed federation title fixed header

commitff9676a1e98c4396477dd22721c277897803450f authorRobert <robert@tlon.io> dateTue 24 Apr 2018, 13:13 (9 years ago) parentd1c1013
5 files changed+53−397
docs/arvo/internals.md+1−1 docs/arvo/umarkdown.umd−349 docs/hall/architecture.md+19−16 docs/hall/interface.md+8−8 docs/hall/new-gall.md+25−23
docs/arvo/internals.md+1−1
@@ -1,6 +1,6 @@
11---
22navhome: /docs/
3−next: true
3+next: false
44sort: 22
55Title: Internals
66---
docs/arvo/umarkdown.umddeleted−349
@@ -1,349 +0,0 @@
1−:- :~ navhome/'/docs/'
2− sort/'23'
3− title/'Markdown'
4− ==
5−;>
6−
7−_Thanks to ~rovnys-ricfer for writing this._
8−
9−# Urbit-Flavored Markdown
10−
11−## Overview
12−
13−Urbit-Flavored Markdown (UFM) is a minimal markup language for creating and rendering text documents,
14−with a [Markdown](https://en.wikipedia.org/wiki/Markdown)-inspired syntax. It's integrated with the Hoon programming
15−language, allowing it to be used as standalone prose in its own file or inside
16−a hoon source file, in which case it will be parsed into a tree of HTML nodes
17−using Hoon's `sail` datatype.
18−
19−UFM is stricter than Markdown and generally supports only one syntax for each
20−type of HTML node that it emits.
21−
22−### Headers
23−
24−Headers in UFM begin with one or more `#` characters, followed by a space. The
25−number of leading `#`s corresponds to the resulting HTML element: `#` yields an
26−`<h1>`; `##` yields the slightly smaller `<h2>`; and so on, through `<h6>`.
27−
28−Example:
29−```
30−### Header (h3)
31−
32−##### Header (h5)
33−```
34−produces:
35−
36−> ### Header (h3)
37−
38− ##### Header (h5)
39−
40−### Lists
41−
42−A line beginning with a `-` or `+` followed by a space is interpreted as an
43−element of a list. `-` means unordered list (`<ul>`) and `+` means ordered list
44−(`<ol>`).
45−
46−Example:
47−
48−```
49−- unordered 1
50− text on newline shows up on same line
51−- unordered 2\
52− text on newline after `\` puts in <br> line break
53−
54−- unordered after 1 blank line
55− - nested
56− - double-nested
57−
58−+ leading '+'
59−+ leading '+'
60−- unordered '-'
61− + nested ordered '+' item 1
62− + nested ordered '+' item 2
63−
64−+ ordered '+'
65− + nested item 1
66− + nested item 2
67−```
68−
69−produces:
70−
71−> - unordered 1
72− text on newline shows up on same line
73− - unordered 2\
74− text on newline after `\` puts in <br> line break
75−
76− - unordered after 1 blank line
77− - nested
78− - double-nested
79−
80− + leading '+'
81− + leading '+'
82− - unordered '-'
83− + nested ordered '+' item 1
84− + nested ordered '+' item 2
85−
86− + ordered '+'
87− + nested item 1
88− + nested item 2
89−
90−### Blockquotes
91−
92−A section of text beginning with `> ` and indented by two spaces yields a
93−`<blockquote>` element. This blockquote can itself turn contain more UFM,
94−including more blockquotes to render nested levels of quotation.
95−
96−Example:
97−
98−```
99−> As Gregor Samsa awoke one morning from uneasy dreams
100− he found himself _transformed_ in his bed into a *monstrous* vermin.
101−```
102−
103−produces:
104−
105−> > As Gregor Samsa awoke one morning from uneasy dreams
106− he found himself _transformed_ in his bed into a *monstrous* vermin.
107−
108−### Code blocks
109−
110−By enclosing a block of text in `\`\`\` on their own lines
111−before and after the block, the text will be treated as a code block.
112−
113−Example:
114−
115−```
116−> ```
117− (def Y (fn [f]
118− ((fn [x]
119− (x x))
120− (fn [x]
121− (f (fn [y]
122− ((x x) y)))))))
123− ```
124−```
125−
126−produces:
127−
128−> ```
129− (def Y (fn [f]
130− ((fn [x]
131− (x x))
132− (fn [x]
133− (f (fn [y]
134− ((x x) y)))))))
135− ```
136−
137−### Poems
138−
139−A poem is a section of text with meaningful newlines. Normally in UFM,
140−newlines are treated as spaces and do not create a new line of text. If you
141−want to embed text where newlines are retained, then indent the text by
142−question with eight spaces.
143−
144−Example:
145−```
146− A shape with lion body and the head of a man,
147− A gaze blank and pitiless as the sun,
148− Is moving its slow thighs, while all about it
149− Reel shadows of the indignant desert birds.
150−```
151−produces:
152−> A shape with lion body and the head of a man,
153− A gaze blank and pitiless as the sun,
154− Is moving its slow thighs, while all about it
155− Reel shadows of the indignant desert birds.
156−
157−### Sail expressions
158−
159−It's possible to use Urbit-Flavored Markdown as an HTML-templating language akin to
160−PHP, ERB, JSP, or Handlebars templates. This facility derives
161−in part from the support for embedding Hoon code inside the markup.
162−There are two ways to do embed Hoon in UFM: inline expressions and `sail`.
163−[Sail](https://urbit.org/fora/posts/~2017.7.6..21.27.00..bebb~/)
164−is a DSL within Hoon for creating XML nodes, including HTML. It can
165−be used directly within UFM to provide scripting capability and also to
166−provide more fine-grained control over the resulting HTML.
167−
168−Example:
169−```
170−;=
171− ;p
172− ;strong: Don't panic!
173− ;br;
174− ;small: [reactive publishing intensifies]
175− ==
176−==
177−```
178−
179−produces:
180−> ;=
181− ;p
182− ;strong: Don't panic!
183− ;br;
184− ;small: [reactive publishing intensifies]
185− ==
186− ==
187−
188−_Note:
189−[Urbit's web-publishing system](https://urbit.org/docs/arvo/web-apps/)
190−currently does not apply `<style>` elements or element attributes,
191−which are supported in `sail` syntax. Future versions of the publishing
192−system will rectify this._
193−
194−### Horizontal rules
195−
196−`---` on its own line produces an `<hr>` element, the 'horizontal rule'.
197−This is rendered as a horizontal line the width of its containing paragraph.
198−
199−Example:
200−```
201−Above the line
202−---
203−Below the line
204−```
205−> :: produces:\
206− Above the line
207− ---
208− Below the line
209−
210−### Inline markup
211−
212−In addition to the above, UFM includes several options for marking up
213−inline text.
214−
215−##### Bold
216−
217−Enclose some text in asterisks to boldly render it inside a `<b>` element.
218−
219−Example:
220−```
221−The first rule of tautology club is
222−*the first rule of tautology club*.
223−```
224−produces:\
225−
226−> The first rule of tautology club is
227− *the first rule of tautology club*.
228−
229−##### Italics
230−
231−Surrounding text with `_` on each side will cause it to appear
232−in italics, using an <i> element.
233−
234−Example:
235−```
236−Bueller? _Bueller?_
237−```
238−
239−produces:
240−
241−Bueller? _Bueller?_
242−
243−##### Double quote
244−
245−Text enclosed in double quotes (`"`) will be rendered with
246−opening and closing quotes.
247−
248−Example:
249−```
250−"Yes," he said. "That is the way with him."
251−```
252−produces:\
253−
254−"Yes," he said. "That is the way with him."
255−
256−##### Backslash escape
257−
258−A backslash directly before a word (with no spaces) will be interpreted
259−as an escape character, causing it to be rendered raw.
260−
261−Example:
262−```
263−Here is some *bold* text.
264−Here is some \*not bold\* text.
265−```
266−produces:
267−
268−Here is some *bold* text.
269−Here is some \*not bold\* text.
270−
271−##### Trailing backslash
272−
273−A backslash at the end of a line inserts a line break (`<br>`)
274−after that line. This contrasts with the normal UFM behavior of
275−converting newlines to spaces.
276−
277−Example:
278−```
279−I wonder how long each line
280−will be if I put backslashes\
281−at the ends of the lines.
282−```
283−produces:
284−
285−I wonder how long each line
286−will be if I put backslashes\
287−at the ends of the lines.
288−
289−##### Inline code literal
290−
291−Enclosing some text in ``` characters will cause it to be displayed as code,
292−inside a <code> element with monospace font and a different background color.
293−
294−Example:
295−```
296−`*[a 2 b c] -> *[*[a b] *[a c]]` is like lisp's `apply`.
297−```
298−produces:\
299−
300−`*[a 2 b c] -> *[*[a b] *[a c]]` is like lisp's `apply`.
301−
302−Also, using the `++` prefix before a word will cause the word
303−to be rendered as code, since that's the standard notation
304−for an `arm` in Hoon.
305−
306−Example:
307−```
308−The UFM parser is part of ++vast.
309−```
310−produces:\
311−
312−The UFM parser is part of ++vast.
313−
314−##### Hoon constants
315−
316−Hoon has several syntactic forms for literals (numbers, strings, dates, etc.)
317−that can be used in UFM as well. They will appear inside a <code> element like
318−inline code.
319−
320−Example:
321−
322−```
323−~2017.8.29 \
324−0xdead.beef \
325−%term
326−```
327−
328−produces:\
329−
330−~2017.8.29 \
331−0xdead.beef \
332−%term
333−
334−##### Url
335−
336−To insert a hyperlink, put the text content of the link in `[]` brackets
337−followed by the destination URL in `()` parentheses. Note that the text
338−of the displayed link can contain Markdown styling.
339−
340−Example:
341−
342−```
343−A [Hoon `core`](https://urbit.org/docs/hoon/concepts/#-core-object)
344−is similar to an object in a traditional programming language.
345−```
346−produces:\
347−
348−A [Hoon `core`](https://urbit.org/docs/hoon/concepts/#-core-object)
349−is similar to an object in a traditional programming language.
docs/hall/architecture.md+19−16
@@ -10,7 +10,7 @@ title: Hall architecture
1010
1111This document is complemented by Hall's source code, but doesn't require it. Definitions of data structures, code snippets and diagrams will be provided where useful.
1212
13−Hall's implementation is structured according to the new Gall model. Familiarity with its concepts is assumed. See [the new Gall model](../new-gall).
13+Hall's implementation is structured according to the new Gall model. Familiarity with its concepts is assumed. See [the new Gall model](new-gall).
1414
1515## Table of contents
1616
@@ -28,9 +28,9 @@ Hall's implementation is structured according to the new Gall model. Familiarity
2828 * [Interactions](#interactions)
2929 * [Queries, prizes and rumors](#queries-prizes-and-rumors)
3030* [Communication between Halls](#communication-between-halls)
31− * [Interactions](#interactions-1)
31+ * [Commands](#commands)
3232 * [Querying](#querying)
33− * [Federation](#federation)
33+ * [Federation implementation](#federation-implementation)
3434* [Hall implementation](#hall-implementation)
3535 * [Subscriptions](#subscriptions)
3636 * [Rumors](#rumors)
@@ -42,9 +42,9 @@ Hall's implementation is structured according to the new Gall model. Familiarity
4242
4343## Introduction
4444
45−Talk was Urbit's first big user-facing application. It continues to enjoy a prominent role in the Urbit landscape, but does so as two separate applications this time.
45+Talk was Urbit's first big user-facing application. It continues to enjoy a prominent role in the Urbit landscape, but now does so as two separate applications.
4646
47−The messaging parts of Talk have been separated from its user interface parts. What we ended up with is a shiny new generic messaging bus, and the chat interface we all know and love. The messaging bus, which should now prove useful to many different applications, will be named `Hall`. Applications that use it are referred to as *clients*. One such application, as you might have guessed, is `Talk`.
47+The messaging parts of Talk have been separated from its user-interface parts. What we ended up with is a shiny new generic messaging bus, and the chat interface we all know and love. The messaging bus, which should now prove useful to many different applications, will be named `Hall`. Applications that use it are referred to as *clients*. One such application, as you might have guessed, is `:talk`.
4848
4949
5050## Structures & functionality
@@ -117,6 +117,7 @@ Messages aren't the only thing a subscription gets us. We're also kept up to dat
117117```
118118
119119`status` is user-set metadata that describes, well, the status of users in a circle. This encompasses their `presence`, which shows their activity, and their `human` identity, which includes their display handle.
120+
120121For reasons we'll discover shortly, circles keep track of both their own `group` and those of the circles they're subscribed to. `crowd` encapsulates this.
121122
122123### Configurations
@@ -191,9 +192,10 @@ As an example, Talk operates like this, serving as an interface for reading from
191192
192193### Federation
193194
194−Some places, like `urbit-meta`, will want to be easily accessible to everyone on the network, and actually support the load that comes with that. Both these desired can be met through federation.
195+Some places, like `urbit-meta`, will want to be easily accessible to everyone on the network, and actually support the load that comes with that. Both of these desires can be achieved through federation.
196+
197+With federation, stories and any changes to them trickle down from ~zod, to other galaxies, to their stars. Only changes to messages and presence can also move upstream, from stars, to galaxies, to ~zod (and then back down again).
195198
196−In federation, stories and any changes to them trickle down from ~zod, to other galaxies, to their stars. Only changes to messages and presence can also move upstream, from stars, to galaxies, to ~zod (and then back down again).
197199This way, all planets and comets will be able to subscribe to `/urbit-meta` (that is, the `urbit-meta` circle on their parent ship) and get all updates on the story, regardless of where on the network they originated.
198200
199201### Public membership
@@ -286,6 +288,7 @@ To receive data from Hall, applications will have to query it. There are two pat
286288```
287289
288290To be clear, the paths for those queries are `/client` and `/circle/[name]/[data]/[start]/[end]`, where data is at least one `circle-data`, and `start` and `end` are optional and can be either a date or a message number.
291+
289292`/client` queries produce shared UI state. That is, glyph bindings and nicknames.
290293`/circle` queries produce the entire public state of the requested story, including remotes.
291294
@@ -341,9 +344,9 @@ These are, as enforced by Gall, the changes as they happen. This makes it possib
341344
342345## Communication between Halls
343346
344−Halls can communicate with other Halls to send commands and subscription updates.
347+Halls can communicate with other Halls by sending commands and subscription updates.
345348
346−### Interactions
349+### Commands
347350
348351To request changes to a story, Halls can send `command`s.
349352
@@ -373,11 +376,12 @@ Halls can query other halls. Here's the peer move we send when we open a query o
373376```
374377
375378Again, the rumor path is what our Hall uses to identify what query a received message originates from. Our circle is specified so that we know what story is interested in the changes we get.
379+
376380The query path is slightly more interesting. Of course it specifies the name of their story we want to subscribe our story to, but also a "start" and "end". These can (optionally) be used to specify the range of messages we want to get from our query. Once that range has passed, we stop receiving updates.
377381
378−### Federation
382+### Federation implementation
379383
380−Along the way so far, we've skipped some parts of structures. Most of these relate to federation. Let's see what we missed.
384+Along the way so far, we've skipped some parts of structures. Most of those relate to federation. Let's see what we missed.
381385
382386```
383387++ query :> query paths
@@ -496,22 +500,21 @@ Hall is neither complete nor perfect. There are features that need to be impleme
496500
497501To turn Talk into a [sustainable social platform](https://urbit.org/fora/posts/~2017.4.26..18.00.25..b93c~/), it needs a number of things.
498502
499−Primarily, discoverability of circles. A possible solution for realizing this is making it possible for users to add friends, which would have their Hall subscribe to a list of circles the added friends are in. The existing public membership functionality can be leveraged for this.
503+We want to have some kind of discoverability for circles. This could be realized by making it possible for users to add friends, who would have their Hall subscribe to a list of circles the added friends are in. The existing public membership functionality can be leveraged for this.
500504
501505Eventually, content self-moderation might need to be implemented. Users would flag their content if it is potentially offensive. Others would easily be able to filter out content that might offend them.
502506This functionality brings its own large sets of challenges that need to be tackled.
503507
504−Additionally, federation might be put to broader use. Knowing a circle is federated could help fall back to alternative hosts in case the one Hall originally subscribed to is unavailable.
505−Implementation-wise, care would need to be taken for this to not get ugly. Not to mention, when/how would availability of a host be verified?
508+Additionally, federation might be put to broader use. Knowing that a circle is federated could help fall back to alternative hosts in case the one Hall originally subscribed to is unavailable. Implementation-wise, care would need to be taken for this to not get ugly. Not to mention, when/how would availability of a host be verified?
506509
507510Other changes that might have a fair impact on the functioning of Hall are un/read states for messages, and being able to use moons to allow your friends to chat with you in a local channel.
508511
509−Smaller functionality that still needs to be implemented includes:
512+More minor functionalities that need to be implemented include:
510513* Extended permissions management. Being able to black-/whitelist entire ship classes.
511514* Improved presence functionality. Actually using the presence system, and sending "typing", "idle", etc. statuses.
512515* Polls.
513516
514−And of course there's a lot Talk, the client, can improve on as well.
517+And, of course, there's a lot that the Talk client can improve on as well.
515518
516519
517520## Further reading
docs/hall/interface.md+8−8
@@ -8,7 +8,7 @@ title: Hall interface
88
99# Hall interface
1010
11−This document describes the different interfaces Hall provides and the data that is accessible and modifyable through them. Knowledge of the Urbit application model (including [new gall](gall.md)) and #[Hall's architecture](architecture.md) is assumed.
11+This document describes the different interfaces Hall provides and the data that is accessible and modifiable through them. Knowledge of the Urbit application model (including [new gall](new-gall)) and [Hall's architecture](architecture) is assumed.
1212
1313While the structures here are given in Hoon, they match fairly closely to their JSON equivalent. Most important to note is that `$%({$x y/z})` becomes accessible as `json.x.y`.
1414
@@ -60,7 +60,7 @@ Valid paths include:
6060
6161#### /client prize
6262
63−Contains a map of glyphs and the audiences they map to, as well as a map of ships and their locally set nicknames.
63+Contains a map of glyphs and the audiences that they map to, as well as a map of ships and their locally set nicknames.
6464
6565```
6666++ prize :> query result
@@ -75,7 +75,7 @@ Contains a map of glyphs and the audiences they map to, as well as a map of ship
7575
7676#### /client rumor
7777
78−Contains either a bound or unbound glyph and its target, or a ship with its new ncikname. A `nic`kname of `''` means the associated ship no longer has a nickname set for it.
78+Contains either a bound or unbound glyph and its target, or a ship with its new nickname. A nickname of `''` means the associated ship no longer has a nickname set for it.
7979
8080```
8181++ rumor :> query result change
@@ -133,7 +133,7 @@ Contains a circle that was either added or removed from the public list.
133133
134134### /peers
135135
136−To allow a circle owner to inspect who is actually currently subscribed to their stories, they can issue a query to retrieve subscription data.
136+To allow a circle owner to inspect who is currently subscribed to their stories, they can issue a query to retrieve subscription data.
137137
138138```
139139++ query ::
@@ -181,7 +181,7 @@ Contains a ship and a query, and a flag to indicate whether that subscription ha
181181
182182Circle queries allow for the retrieving of data from stories. Their messages, configuration, presences, can all be accessed. Since this is a lot of data, there are lots of possibilities for filtering it built in to the query itself.
183183
184−A quick refresher on the difference between "local" and "remote" presence and configuration: "local" means it pertains to the circle itself, "remote" means it pertains to one of its configured sources. The latter is primarily useful to clients when using a circle for aggregation, like the `%inbox`.
184+A quick refresher on the difference between "local" and "remote" presence and configuration: "local" means it pertains to the circle itself, "remote" means it pertains to one of its configured sources. The latter is useful to clients when using a circle for aggregation, like the `%inbox`.
185185
186186```
187187++ query ::
@@ -262,8 +262,8 @@ Contains (where applicable) messages in envelopes (with message numbers), local
262262#### /circle rumor
263263
264264Contains a detailed change description of the data relevant to the query that changed.
265−Messages are wrapped in envelopes to include their sequence number, and note the source they were heard from.
266−Configuration and status changes specify the circle they apply to.
265+
266+Messages are wrapped in envelopes to include their sequence number, and note the source they were heard from. Configuration and status changes specify the circle they apply to.
267267
268268```
269269++ rumor :> query result change
@@ -334,7 +334,7 @@ Since all of these apply to a specific circle, they all specify a name `nom` of
334334
335335### Messaging
336336
337−There are two interfaces for telling hall to send a message. The first takes entire `thought`s, the second only `speech`es and the audience to send them to.
337+There are two interfaces for telling Hall to send a message. The first takes entire `thought`s, the second only `speech`es and the audience to send them to.
338338
339339```
340340++ action :> user action
docs/hall/new-gall.md+25−23
@@ -9,7 +9,7 @@ title: The new Gall model
99
1010This document is complemented by the source code of applications that use the new Gall model (like [Hall](https://github.com/urbit/arvo/blob/master/app/hall.hoon)), but doesn't require it. Code snippets will be provided where useful. Some knowledge of Hoon and the functioning of Hoon apps is assumed.
1111
12−New Gall has not yet fully solidified. As such, structure and naming are tentative to change.
12+New `%gall` has not yet fully solidified. As such, its structure and naming are tentative.
1313
1414## Table of contents
1515
@@ -30,7 +30,8 @@ New Gall has not yet fully solidified. As such, structure and naming are tentati
3030## Renewing a pillar of Arvo
3131
3232When 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.
33−It'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.
33+
34+It'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.
3435
3536### Problems
3637
@@ -39,7 +40,8 @@ Imagine a `++poke`, `++diff`, or even a `++peer` arm. In current implementations
3940Or (sadly) more commonly:
4041`^- {(list move) _+>.$}`
4142
42−These arms are producing both side-effects and new state. To do this, their code has to simultaneously figure out "how does this poke/diff/whatever change our state?" and "what side-effects does this change have?".
43+These arms are producing both side-effects and new state. To do this, their code has to simultaneously figure out "how does this poke/diff/whatever change our state?" and "what side-effects does this change have?"
44+
4345You'll find that the logic relating to these two often becomes tangled, making the flow of the whole more difficult to understand. And the side-effects more often than not relate to subscriptions, for which the developer may be writing a lot of boilerplate code. Gall currently does not help in either of these places.
4446
4547> The main significant cost of software development is the cost of
@@ -51,27 +53,26 @@ cost is extremely welcome.
5153
5254### Solutions
5355
54−Let's imagine a world in which Gall *does* help, in both those places.
56+Let's imagine a world in which Gall *does* help, in both of those places.
57+
58+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. Applications, then, would have to help Gall by providing the different parts of this flow, and providing 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.
59+
60+If we expand on that a bit, then 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.
5561
56−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.
57−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.
62+But where do the side-effects go, then? We need to realize there's two kinds: side-effects that are subscription updates, and side-effects that aren't. The latter get produces by applying state changes, while the former get integrated into the Gall flow we described above.
5863
59−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.
60−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.
61−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.
64+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. Having Gall support all this allows us to cleanly and structurally untangle state change analysis, application, and subscription logic into their own arms.
6265
63−Having Gall support all this allows us to cleanly and structurally untangle state change analysis, application, and subscription logic into their own arms.
64−For 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.
65−For 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.
66+For 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. For more complex apps, all logic is no longer a big chunk of "what do we do when x happens?" Rather, it's a few 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.
6667
6768
6869## As seen in new Gall
6970
70−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.
71+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.
7172
7273### Structures
7374
74−This wouldn't be Urbit if we had some cool new terminology for people to learn. These ones are (for the most part) semantically sensible though, and you might already see how these relate to the story above.
75+This wouldn't be Urbit if we didn't have cool terminology for people to learn. These ones are (for the most part) semantically sensible, and you might already see how they relate to the story above.
7576
7677`brain`: application state.
7778`delta`: change to application state.
@@ -97,11 +98,13 @@ This also wouldn't be Urbit if we couldn't boil that down to a few simple pseudo
9798 (gain rumor:(feel query delta) prize:(peek brain query))
9899```
99100
100−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.
101+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.
101102
102103Of 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.
103−There'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.
104+
105+There'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.
104106`++prep`, `++poke` and `++pull` continue to function as they do right now.
107+
105108For a more verbose specification of all of these, see the new Gall spec.
106109
107110
@@ -160,7 +163,7 @@ Now, let's implement all the arms that will be called as things start happening.
160163 & :: everyone's allowed
161164```
162165
163−Next, let's create the `prize`s for the folks that make it through `++leak`. We'll be producing a `(unit (unit prize))` so we can potentially say `~` for "unavailable" and `[~ ~]` for "invalid query".
166+Next, let's create the `prize`s for the folks that make it through `++leak`. We'll be producing a `(unit (unit prize))` so we can potentially say `~` for "unavailable" and `[~ ~]` for "invalid query."
164167
165168```
166169++ peek :> synchronous read
@@ -173,9 +176,10 @@ Next, let's create the `prize`s for the folks that make it through `++leak`. We'
173176 ==
174177```
175178
179+
176180### Updating state & query results
177181
178−Our app can get queried! If they're interested enough, they'll want to receive updates on that whenever relevant state changes. First, let's see how state changes happen. We still have regular old `++poke` arms, let's use that to prompt our application to change its state.
182+Our app can be queried! If they're interested enough, they'll want to receive updates on that whenever relevant state changes. First, let's see how state changes happen. We still have regular old `++poke` arms, let's use that to prompt our application to change its state.
179183
180184```
181185++ poke-loob :> regular old poke
@@ -231,13 +235,11 @@ As we saw earlier, for `/number` queries the `delta`s match one-on-one with the
231235
232236## Criticism
233237
234−* 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.
235−Because 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.
238+* 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. Because of custom structures being easier to work with than lists of `++knot`s or `++coin`s, writing a `++path-to-query` arm by hand is a small cost for huge gains.
236239
237−* 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.
240+* Why do `prize` units mean what they do? One would expect `~` to mean "invalid" and `[~ ~]` to mean "unavailable" as opposed to the other way around.
238241
239−* 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).
240−While 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?
242+* 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). While 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?
241243
242244* 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.
243245