diff --git a/README.md b/README.md index ae18e50..0974c4c 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,12 @@ assert present.fromPreserve(pr) == true ## The Syndicate DSL -The Syndicate DSL can be entered using `bootDataspace` which calls a Nim body with a [dataspace](https://synit.org/book/glossary.html#dataspace) [Ref](https://synit.org/book/glossary.html#reference) and a [turn](https://synit.org/book/glossary.html#turn). The `Ref` is something that we can observe and publish assertions at, and a `Turn` is special type for temporal scoping and transactional semantics. Assertions can be published using the `Assertion` or equivalent `Preserve[Ref]` type, but using Nim types is preferred because they can be reliably consistent with schema. +The Syndicate DSL can be entered using `runActor` which calls a Nim body with a [dataspace](https://synit.org/book/glossary.html#dataspace) [Ref](https://synit.org/book/glossary.html#reference) and a [turn](https://synit.org/book/glossary.html#turn). The `Ref` is something that we can observe and publish assertions at, and a `Turn` is special type for temporal scoping and transactional semantics. Assertions can be published using the `Assertion` or equivalent `Preserve[Ref]` type, but using Nim types is preferred because they can be reliably consistent with schema. ### Publish ``` nim -bootDataspace("main") do (dataspace: Ref; turn: var Turn): +runActor("main") do (dataspace: Ref; turn: var Turn): let presenceHandle = publish(turn, dataspace, Present(username: "Judy")) # publish to the dataspace # the assertion can be later retracted by handle @@ -67,7 +67,7 @@ bootDataspace("main") do (dataspace: Ref; turn: var Turn): We can react to assertions and messages within dataspaces using [patterns](https://synit.org/book/glossary.html#dataspace-pattern). Patterns are constructed using a Nim type and the `?` operator. Again a Nim type is used rather than a raw Preserves for schema consistency. ``` nim -bootDataspace("main") do (dataspace: Ref; turn: var Turn): +runActor("main") do (dataspace: Ref; turn: var Turn): during(turn, dataspace, ?Present) do (who: string): # This body is active when the ?Present pattern is matched. # The Present type contains two atomic values that can be matched diff --git a/src/syndicate/dataspaces.nim b/src/syndicate/dataspaces.nim index 47ed869..344eec0 100644 --- a/src/syndicate/dataspaces.nim +++ b/src/syndicate/dataspaces.nim @@ -41,7 +41,7 @@ proc newDataspace*(turn: var Turn): Ref = type BootProc = proc (ds: Ref; turn: var Turn) {.gcsafe.} -proc bootDataspace*(name: string; bootProc: BootProc): Actor {.discardable.} = +proc bootDataspace*(name: string; bootProc: BootProc): Actor = bootActor(name) do (turn: var Turn): discard turn.facet.preventInertCheck() bootProc(newDataspace(turn), turn) diff --git a/src/syndicate/protocols/sturdy.nim b/src/syndicate/protocols/sturdy.nim index 925c50c..570b5cc 100644 --- a/src/syndicate/protocols/sturdy.nim +++ b/src/syndicate/protocols/sturdy.nim @@ -53,8 +53,8 @@ type SturdyDescriptionDetail*[Cap] {.preservesDictionary.} = object - `oid`*: Preserve[Cap] `key`*: seq[byte] + `oid`*: Preserve[Cap] PAnd*[Cap] {.preservesRecord: "and".} = ref object `patterns`*: seq[Pattern[Cap]] diff --git a/syndicate.nimble b/syndicate.nimble index 77a2d44..13e0027 100644 --- a/syndicate.nimble +++ b/syndicate.nimble @@ -1,6 +1,6 @@ # Package -version = "20230611" +version = "20230630" author = "Emery Hemingway" description = "Syndicated actors for conversational concurrency" license = "Unlicense"