Skip to content

Handle requirements properly as part of the type system #231

Open
@byorgey

Description

Describe the bug
It seems that programs run by base are only checked dynamically for capabilities. This means that both

  1. The base can get quite a ways through a program before crashing due to a missing capability
  2. 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 the move 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

No one assigned

    Labels

    BugThe observed behaviour is incorrect or unexpected.C-ProjectA larger project, more suitable for experienced contributors.L-Capability checkingCapability checking determines which capabilities are required by a given piece of code.L-Type systemIssues related to the Swarm language type system.S-ModerateThe fix or feature would substantially improve user experience.Z-ResearchThis issue requires inventing something new and/or studying research papers for clues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions