move start_reading/start_writing out of template
commit38ff2ddf11dc686a83be721d705e86c48538c837
authorKartik K. Agaram <vc@akkartik.com>
Sun, 6 Mar 2022 17:13:34 +0000 (6 09:13 -0800)
committerKartik K. Agaram <vc@akkartik.com>
Sun, 6 Mar 2022 17:21:32 +0000 (6 09:21 -0800)
tree3d37e37a7fd0b1ece6934864b2e2710d818b357f
parentdb7fd08e05dc62497bf836c9ff781d91ee2b1c8b
move start_reading/start_writing out of template

When should code go in the template used by new apps vs the .lua files
distributed with Teliva?

- from a privilege perspective there's no difference
- from a compatibility perspective stuff in .tlv will not get upgraded
  with Teliva.
- for me the maintainer, functions in .lua files are easier to upgrade
  in a single place.
- for the reader of an app, functions in .lua files will not show up to
  be edited. They can still be overloaded, but the current version isn't
  as discoverable. Putting something in the app is a slight nudge to
  readers that they're encouraged to mess with it.
- Stuff in .lua files can use local functions and so have more internal
  complexity. Apps can also hide details within functions, but that'll
  make them more likely to run into limitations with Teliva's editing
  environment.

I'm not yet sure how to reason about the second point in practice.
  - Stuff in .tlv files I don't have to worry about compatibility
    guarantees for.
  - Stuff in .lua files I _do_ have to worry about compatibility
    guarantees for.

Perhaps this means I'm doing things exactly wrong in this commit?
Functions like map/reduce/filter/append seem more timeless, whereas I'm
still just feeling my way around with start_reading and start_writing.

We'll see. For now I'm ruled by the fourth point. Messing with tasks and
the scheduler is much more advanced than anything else in template.tlv;
it seems to make sense to add some friction to modifying them.

Bottomline: Complex sub-systems go in .lua files. Simple, self-contained
definitions go into apps. Both are probably equally burdensome now from
a compatibility perspective.
life.tlv
src/file.lua [new file with mode: 0644]
src/lua.c
template.tlv
zet.tlv