Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform requirements analysis on static argument to use command #1301

Closed
kostmo opened this issue Jun 3, 2023 · 1 comment · Fixed by #2211
Closed

Perform requirements analysis on static argument to use command #1301

kostmo opened this issue Jun 3, 2023 · 1 comment · Fixed by #2211
Assignees
Labels
C-Low Hanging Fruit Ideal issue for new contributors. L-Capability checking Capability checking determines which capabilities are required by a given piece of code. L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. S-Moderate The fix or feature would substantially improve user experience. Z-Feature A new feature to be added to the game.

Comments

@kostmo
Copy link
Member

kostmo commented Jun 3, 2023

From #1287 (comment):

If you write a program like build {move; use "flerb" forward; move} it will fail, because the requirements analysis will not figure out that we should automatically equip a flerb when building the child robot. You would have to explicitly write e.g. build {move; require "flerb"; use "flerb" forward; move}. We might consider adding something to the requirements analysis which will at least work when use is applied to a statically known device name, as in this example.

@kostmo kostmo added Z-Feature A new feature to be added to the game. L-Capability checking Capability checking determines which capabilities are required by a given piece of code. L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. labels Jun 3, 2023
@kostmo kostmo mentioned this issue Jun 3, 2023
@byorgey byorgey added C-Low Hanging Fruit Ideal issue for new contributors. S-Moderate The fix or feature would substantially improve user experience. labels Jun 3, 2023
@byorgey
Copy link
Member

byorgey commented May 31, 2024

I might do this at some point, but in case someone else wants to tackle it first, it would require adding a special case for TApp (TConst Use) (TText device) to the requirements' function, right before the generic case for TApp:

-- An application simply requires the union of the capabilities
-- from the left- and right-hand sides. This assumes that the
-- argument will be used at least once by the function.
TApp t1 t2 -> go ctx t1 <> go ctx t2

I suppose it should return singletonDev device in that case.

@byorgey byorgey self-assigned this Nov 16, 2024
@mergify mergify bot closed this as completed in #2211 Nov 18, 2024
mergify bot pushed a commit that referenced this issue Nov 18, 2024
In the special case that we have something like `use "key"` we can statically know that it requires a `key` device.  For example, this means that now a program like
```
build { move; use "key"; move }
```
will automatically install a `key` device on the built robot.

Closes #1301.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Low Hanging Fruit Ideal issue for new contributors. L-Capability checking Capability checking determines which capabilities are required by a given piece of code. L-Commands Built-in commands (e.g. move, try, if, ...) in the Swarm language. S-Moderate The fix or feature would substantially improve user experience. Z-Feature A new feature to be added to the game.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants