summary refs log blame commit diff stats
path: root/koch.nim.cfg
blob: 1d7acf579cce289a7173c01360199916a3ed5377 (plain) (tree)
1
         
-d:booting
tring.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
discard """
  output: '''
1
2
3
4
1
2
1
6
'''
"""
import asyncio, asyncdispatch, asyncnet

proc main {.async.} =
  proc f: PFuture[int] {.async.} =
    discard
    echo 1
    discard
    result = 2
    discard

  let x = await f()
  echo x
  echo 3

  proc g: PFuture[int] {.async.} =
    discard
    echo 4
    discard
    result = 6
    discard
    echo await f()
    discard await f()

  discard await g()
  echo 6

asyncCheck main()