diff options
| author | Andrés Cuervo <andrescuervor@gmail.com> | 2023-10-27 16:50:16 +0000 |
|---|---|---|
| committer | Andrés Cuervo <andrescuervor@gmail.com> | 2023-10-27 16:50:16 +0000 |
| commit | ccbcc1e7bf7dbf3fb118a4a06371fe4d0f2147ff (patch) | |
| tree | 9980a884f927312bf6e64a28f3066fb1dd146ce6 /lib/process.tcl | |
| parent | Remove extraneous debug info (diff) | |
| parent | outline: Slight optimization (diff) | |
| download | folk-ccbcc1e7bf7dbf3fb118a4a06371fe4d0f2147ff.tar.gz folk-ccbcc1e7bf7dbf3fb118a4a06371fe4d0f2147ff.zip | |
Merge branch 'main' into ac/editor
Diffstat (limited to 'lib/process.tcl')
| -rw-r--r-- | lib/process.tcl | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/process.tcl b/lib/process.tcl index 059c0b89..faaa5e84 100644 --- a/lib/process.tcl +++ b/lib/process.tcl @@ -56,21 +56,35 @@ namespace eval ::Zygote { } } -proc On-process {name body} { +proc Start-process {name body} { + if {[namespace exists ::Peers::$name]} { + error "Process $name already exists" + return + } + set this [uplevel {expr {[info exists this] ? $this : "<unknown>"}}] set processCode [list apply {{__parentProcess __name __body} { set ::thisProcess $__name - Assert <lib/process.tcl> wishes $::thisProcess shares all wishes - Assert <lib/process.tcl> wishes $::thisProcess shares all claims - ::peer $__parentProcess true + Assert <lib/process.tcl> wishes $::thisProcess shares statements like \ + [list /someone/ claims $::thisProcess has pid /something/] + Assert <lib/process.tcl> wishes $::thisProcess receives statements like \ + [list /someone/ wishes program code /code/ runs on $::thisProcess] + Assert <lib/process.tcl> wishes $::thisProcess shares statements like \ + [list /someone/ wishes $::thisProcess receives statements like /pattern/] + Assert <lib/process.tcl> claims $::thisProcess has pid [pid] - Assert when $::thisProcess has pid /something/ [list {} $__body] - while true { - Step - } + # Run __body one Step before running any other program code. + Assert when $::thisProcess has pid /something/ [list {__body} { + When /someone/ wishes program code /__code/ runs on $::thisProcess { + eval $__code + } + eval $__body + }] with environment [list $__body] + + while true { Step } }} $::thisProcess $name $body] ::peer $name false |
