Closed prismofeverything closed 9 months ago
One more thing: due to the egregious imports between base_types.py
and type_system.py
I have pulled all the functions from base_types.py
into type_system.py
.... we are planning a future reorganization for the specification of types which will address this.
We have added three fundamental operations to the type system, two of which require a new registry as well (check/react).
check
- Given a schema and any value, returnsTrue
if the value matches the schema,False
otherwise. This also requires a registry for each built in type to make this distinction at the language level.match
- Given a schema, a state tree, and a pattern (the "redex"), find paths in the tree that match the pattern. There are a few modes for this depending on how many results you are interested in (immediate/first/random/all)react
- This is an implementation of Milner's bigraphical reactions. Given a schema, a state tree, and a "reaction" (which contains either a redex/reactum pair or a reference to a function in thereact
registry that generates the redex/reactum), return the tree with matching redexes substituted with the corresponding reactum, according to thematch
mode (immediate/first/random/all). This defaults torandom
according to Milner's original formalism, though in practice we will probably usefirst
more often (?)A number of reactions are provided (add/remove/replace), with a notable exception (divide). A future PR will address reactions that require a change of state as well as structure during the reaction (which goes beyond bigraphical reactions which deal only in structure), as required by divide and many other useful reactions yet to be conceived.
All feedback welcome!