Handle requirements properly as part of the type system #231
Open
Description
Describe the bug
It seems that programs run by base
are only checked dynamically for capabilities. This means that both
- The base can get quite a ways through a program before crashing due to a missing capability
- Some capabilities sneak by since they don't correspond directly to a command and are thus never dynamically checked. For example, recursion is such a capability.
To Reproduce
- Run
build "x" {move}; move
to see that the base builds the robot"x"
first before failing to execute themove
due to a missing capability. Ideally, it should instead refuse to run the entire program due to missing capabilities. - As a different example,
def forever = \c. c ; forever c end
build "x" {forever move}
forever (build "x" {move})
The build "x"
fails as it should with an error saying that you don't have the necessarily devices to install on x
(namely, a lambda and a strange loop). However, the last line works fine even though it shouldn't, since the base
doesn't have a lambda or strange loop.
Metadata
Assignees
Labels
The observed behaviour is incorrect or unexpected.A larger project, more suitable for experienced contributors.Capability checking determines which capabilities are required by a given piece of code.Issues related to the Swarm language type system.The fix or feature would substantially improve user experience.This issue requires inventing something new and/or studying research papers for clues.