hawk is a
tree-shaped spreadsheet
where the formula language is hoon
and formula outputs are html nodes
the traditional spreadsheet grid has an intuitive programming model.
so intuitive, in fact, that many people figure it out without even realizing they are programming.
let's look at the ways it achieves that simplicity and the ways in which its programming model can be tweaked to create a more powerful document editor.
spreadsheet users program within a spatial environment.
and they are aware of that environment and its shape.
each location in the environment has a unique name, and users are aware of those names.
when the user understands the mechanics of the environment they are within, and how the naming system works, programming becomes easy.
spreadsheets get rid of a lot of programming concepts.
spreadsheet users program without the ability to:
define types
emit effects
write named functions
everything is a basic datatype so all code is just simple transformations of those basic types: strings, numbers, dates, booleans.
instead of emitting effects or passing messages, you just compute some transformation on a cell, and anything that is subscribed to it gets re-computed as well.
instead of abstracting by writing named functions, you write unnamed bits of code (lambdas) and just copy them to all the places needed.
these limitations are productive.
while spreadsheet are a great tool for some tasks, the grid shape cannot represent most of the documents that humans want.
1) it's hard to define higher-level input mechanisms
2) it's hard to represent hierarchy
3) it's hard to style text for readability
4) it's hard to view grids on small screens
with the goal of creating a more powerful document structure, hawk takes the overall concept of spreadsheets, but makes some key changes.
1) use a more expressive environment shape: trees
2) use a more expressive formula language: hoon
3) use a more visual output type: html
creating html nodes in hoon is ergonomic
html nodes can store data by encoding it into attributes
html nodes can contain bespoke forms/inputs for modifying themselves
of course, these “improvements” have their own limitations, but we believe them to be more productive.
hawk mostly retains (but relaxes) the constraints around user-defined types, emitting effects, and writing functions.
in a grid spreadsheet, you declare a subscription with a reference like C1
or $D$8
.
in the tree-shaped model, you use a path like /favorites/bird
or /a/b/
when a page changes, all of its subscribers update accordingly.
hawk pages are implicitly subscribed to all of their sub-pages.
hawk pages may explicitly subscribe to other pages by referencing a path.
hawk dreams of a computer simple enough that the primary verbs are not “use” and “consume”... but “program” and “create”.