DSL: rename "asserting" to "publish"
This should be more legible if there is less confusion with the Nim "assert" builtin.
This commit is contained in:
parent
2636fa8f0a
commit
6cd5887b4c
|
@ -150,7 +150,7 @@ template onStop*(body: untyped): untyped =
|
|||
proc getCurrentFacet(): Facet {.inject, used.} = facet
|
||||
body
|
||||
|
||||
template asserting*(a: Preserve): untyped =
|
||||
template publish*(a: Preserve): untyped =
|
||||
mixin getCurrentFacet
|
||||
getCurrentFacet().addEndpoint do (_: Facet) -> EndpointSpec:
|
||||
result.assertion = a
|
||||
|
|
|
@ -29,8 +29,8 @@ syndicate timerDriver:
|
|||
if period > 0:
|
||||
getCurrentFacet().beginExternalTask()
|
||||
addTimer(period.int, oneshot = true) do (fd: AsyncFD) -> bool:
|
||||
react: asserting: prsTimeLaterThan(deadline)
|
||||
react: publish: prsTimeLaterThan(deadline)
|
||||
getCurrentFacet().endExternalTask()
|
||||
true
|
||||
else:
|
||||
react: asserting: prsTimeLaterThan(deadline)
|
||||
react: publish: prsTimeLaterThan(deadline)
|
||||
|
|
|
@ -28,7 +28,7 @@ syndicate chat:
|
|||
echo who, " says ", what
|
||||
|
||||
spawn "chat":
|
||||
asserting present(me)
|
||||
publish present(me)
|
||||
during (present(me)):
|
||||
let
|
||||
inputFacet = getCurrentFacet()
|
||||
|
|
|
@ -11,7 +11,7 @@ syndicate testDsl:
|
|||
|
||||
spawn "box":
|
||||
field(currentValue, BiggestInt, 0)
|
||||
asserting prsBoxState(currentValue.get)
|
||||
publish prsBoxState(currentValue.get)
|
||||
stopIf currentValue.get == 10:
|
||||
echo "box: terminating"
|
||||
onMessage(prsSetBox(?newValue)) do (newValue: int):
|
||||
|
|
Loading…
Reference in New Issue