private vars

This commit is contained in:
2025-12-19 00:10:19 -06:00
parent 0bc0472a2f
commit 4bdbde52a0
21 changed files with 73 additions and 179 deletions

View File

@@ -56,13 +56,13 @@ var hello = use('examples/hello')
log.console(hello.greet('Cell'))
$_.receiver(function(msg) {
$receiver(function(msg) {
if (msg.type == 'ping') {
send(msg, {type:'pong'})
}
})
$_.delay(_ => $_.stop(), 0.1)
$delay(_ => $stop(), 0.1)
```
Run it:
@@ -71,7 +71,7 @@ Run it:
Notes:
- Modules are `*.cm` and must return a value. The engine deepfreezes return values, so mutate via new objects or closures rather than inplace.
- Programs are `*.ce` and must not return a value. They run toptobottom when spawned and can register handlers via `$_.receiver()` and schedule work via `$_.delay()` or `$_.clock()`.
- Programs are `*.ce` and must not return a value. They run toptobottom when spawned and can register handlers via `$receiver()` and schedule work via `$delay()` or `$clock()`.
## 5) Spawning Child Programs (Actors)
@@ -80,19 +80,19 @@ Programs can spawn other programs and receive lifecycle events.
- File: `examples/spawner.ce`
```javascript
$_.receiver(function(e) {
$receiver(function(e) {
if (e.type == 'greet' && e.actor) {
log.console('Child greeted me')
}
})
$_.start(function(info) {
$start(function(info) {
if (info.type == 'greet') {
log.console('Spawned child actor')
}
}, 'examples/hello.ce')
$_.delay(_ => $_.stop(), 0.5)
$delay(_ => $stop(), 0.5)
```
Run it: