shrub/pkg/arvo/sys/vane
Philip Monk e3a8cab943 khan: support inline threads
This allows you to pass a thread directly into khan, instead of passing
a filename.  This has several implications:

- The friction for using threads from an app is significantly lower.
  Consider:

    =/  shed
      =/  m  (strand ,vase)
      ;<  ~  bind:m  (poke:strandio [our %hood] %helm-hi !>('hi'))
      ;<  ~  bind:m  (poke:strandio [our %hood] %helm-hi !>('there'))
      (pure:m !>('product'))
    [%pass /wire %arvo %k %lard %base shed]

- These threads close over their subject, so you don't need to parse
  arguments out from a vase -- you can just refer to them.  The produced
  value must still be a vase.

    ++  hi-ship
      |=  [=ship msg1=@t msg2=@t]
      =/  shed
        =/  m  (strand ,vase)
        ;<  ~  bind:m  (poke:strandio [ship %hood] %helm-hi !>(msg1))
        ;<  ~  bind:m  (poke:strandio [ship %hood] %helm-hi !>(msg2))
        (pure:m !>('product'))
      [%pass /wire %arvo %k %lard %base shed]

- Inline threads can be added to the dojo, though this PR does not add
  any sugar for this.

    =strandio -build-file %/lib/strandio/hoon
    =sh |=  message=@t
        =/  m  (strand:rand ,vase)
        ;<  ~  bind:m  (poke:strandio [our %hood] %helm-hi !>('hi'))
        ;<  ~  bind:m  (poke:strandio [our %hood] %helm-hi !>(message))
        (pure:m !>('product'))
    |pass [%k %lard %base (sh 'the message')]

Implementation notes:
- Review the commits separately: the first is small and implements the
  real feature.  The second moves the strand types into lull so khan can
  refer to them.

- In lull, I wanted to put +rand inside +khan, but this fails to that
  issue that puts the compiler in a loop.  +rand depends on +gall, which
  depends on +sign-arvo, which depends on +khan.  If +rand is in +khan,
  this spins the compiler.  The usual solution is to either move
  everything into the same battery (very ugly here) or break the
  recursion (which we do here).
2022-08-29 21:04:50 -08:00
..
ames.hoon ames: prevent larval stage from possibly clobbering adult state 2022-08-23 10:37:01 -04:00
behn.hoon behn: cleans up comments 2022-06-17 22:20:16 -04:00
clay.hoon Revert "clay: render syntax errors at end of file" 2022-07-07 16:21:43 +02:00
dill.hoon clay: seek wip 2022-04-12 21:02:50 -07:00
eyre.hoon eyre: fix for %trim bug - addendum 2022-07-08 17:10:41 -07:00
gall.hoon gall: don't inject potentially-fake acks 2022-08-19 21:39:44 +02:00
iris.hoon strandio: fail when http request gets cancelled 2021-09-28 20:51:51 +04:00
jael.hoon azimuth: fetch snapshot on boot 2022-06-30 23:22:50 -07:00
khan.hoon khan: support inline threads 2022-08-29 21:04:50 -08:00