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:
Emery Hemingway 2021-09-22 14:39:30 +02:00
parent 2636fa8f0a
commit 6cd5887b4c
4 changed files with 5 additions and 5 deletions

View File

@ -150,7 +150,7 @@ template onStop*(body: untyped): untyped =
proc getCurrentFacet(): Facet {.inject, used.} = facet proc getCurrentFacet(): Facet {.inject, used.} = facet
body body
template asserting*(a: Preserve): untyped = template publish*(a: Preserve): untyped =
mixin getCurrentFacet mixin getCurrentFacet
getCurrentFacet().addEndpoint do (_: Facet) -> EndpointSpec: getCurrentFacet().addEndpoint do (_: Facet) -> EndpointSpec:
result.assertion = a result.assertion = a

View File

@ -29,8 +29,8 @@ syndicate timerDriver:
if period > 0: if period > 0:
getCurrentFacet().beginExternalTask() getCurrentFacet().beginExternalTask()
addTimer(period.int, oneshot = true) do (fd: AsyncFD) -> bool: addTimer(period.int, oneshot = true) do (fd: AsyncFD) -> bool:
react: asserting: prsTimeLaterThan(deadline) react: publish: prsTimeLaterThan(deadline)
getCurrentFacet().endExternalTask() getCurrentFacet().endExternalTask()
true true
else: else:
react: asserting: prsTimeLaterThan(deadline) react: publish: prsTimeLaterThan(deadline)

View File

@ -28,7 +28,7 @@ syndicate chat:
echo who, " says ", what echo who, " says ", what
spawn "chat": spawn "chat":
asserting present(me) publish present(me)
during (present(me)): during (present(me)):
let let
inputFacet = getCurrentFacet() inputFacet = getCurrentFacet()

View File

@ -11,7 +11,7 @@ syndicate testDsl:
spawn "box": spawn "box":
field(currentValue, BiggestInt, 0) field(currentValue, BiggestInt, 0)
asserting prsBoxState(currentValue.get) publish prsBoxState(currentValue.get)
stopIf currentValue.get == 10: stopIf currentValue.get == 10:
echo "box: terminating" echo "box: terminating"
onMessage(prsSetBox(?newValue)) do (newValue: int): onMessage(prsSetBox(?newValue)) do (newValue: int):