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

Add choice type #114

Closed
stdweird opened this issue Jun 17, 2016 · 0 comments
Closed

Add choice type #114

stdweird opened this issue Jun 17, 2016 · 0 comments
Assignees

Comments

@stdweird
Copy link
Member

The choice type determines if a string is in a list of possible choices (name from to the python optparse choice option). This would replace the current heavy usage of string with match(SELF, '^(a|b|c)$') with

    "attr" ? choice('a', 'b', 'c')

String as a basetype is the most common one (or even only one). makes no sense for boolean i think, and long already has long(1..4) which is something similar. so only float is not covered, which i think is acceptable.

Related to quattor/template-library-core#102

To be implemented via one of

  • make a new type buitin that does this (we can use function to check type #95 in case someone wants the choice to be usabel via a function function is_choice = {is_type(choice, ARGV);}
  • a new builtin is_choice and we can make a pantype type choice = string[] with is_choice(SELF)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants