18 lines
567 B
Python
18 lines
567 B
Python
# scopes.core.environ
|
|
|
|
"""Defining an environment for the communication system"""
|
|
|
|
from scopes import core
|
|
from scopes.core import actor
|
|
from scopes.core.message import Message
|
|
from scopes.util import keywords as k
|
|
|
|
def program_env(scope: core.Scope) -> core.Proc:
|
|
async def proc(msg: Message, scope: core.Scope) -> None:
|
|
await scope.environ.put(msg)
|
|
return proc
|
|
|
|
def create(meta_env: core.Mailbox, prog: core.Program = program_env) -> core.Mailbox:
|
|
scope = core.create_scope(meta_env, (k.env, k.c00), program=prog)
|
|
return core.neuron(scope)
|
|
|