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

Generalize constraints #6

Open
countvajhula opened this issue Jul 23, 2021 · 0 comments
Open

Generalize constraints #6

countvajhula opened this issue Jul 23, 2021 · 0 comments

Comments

@countvajhula
Copy link
Owner

At the moment, constraints validate some attributes of the input, e.g. that flags are provided a certain number of times, and so on. It would be nice to broaden the scope to ensure conditions that should hold across all provided inputs -- over multiple flags, for instance. Something like:

(constraint (> width height))

... which would ensure that the value received for the width flag is greater than that received for the height flag. The predicate here could be any function, so it could ensure arbitrary conditions on the provided flags -- conditions which could not be asserted within the handler functions for the individual flags.

Another thing is that since both flags as well as the core program are simply functions, it may be possible to leverage Racket's contract system to provide some guarantees. But since CLI scripts are unlikely to return values, and since the arguments and flags are already parsed from strings in each handler function, where appropriate errors may be raised, it seems doubtful that contracts can provide much additional value here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant