Skip to content

Generalize constraints #6

@countvajhula

Description

@countvajhula

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions