-
Notifications
You must be signed in to change notification settings - Fork 26
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 back OneOf
Value constraints
#2655
Comments
As a reminder, this ticket is about building constraints on quantities, specifically 'this quantity must be one of these values' constraints. @NoahCardoso To re-iterate our intended work:
As of right now, we decided that this should involve sets in the generated code, but we can come back to it later to make sure. As such, Finally, |
It all looks good - except that enumerated floats are a bad idea. Once in a while, things will go wrong. I would much rather use integers (i.e. multiply everything by 10) for the internal storage of these numbers. |
This is what I have so far. I'm currently just working on making sure it is displayed properly. How should I go about creating sets in GOOL? I have been able to get the Python example working with sets as a constraint but I have not yet added to GOOL. I assume I would need an I have a WIP branch open #3846. It's pretty rough currently but I will clean it up once I can get things working. |
This is what I have for the C++ example however I am not sure if we should use |
This is looking good. My C++ is too rusty for me to offer advice on which API to use. I'd have to use the same tools you have to investigate (i.e. SE, google, chatGPT, etc) |
FWIW, if a language has some missing features, and we can polyfill them with our own generated code, I see no reason why we shouldn't do that. For example (and I'm not saying we should strive for perfection in this PR, but this is a hypothetical follow-up), we can define our own template <typename E>
bool set_contains(const std::set<E>& set, const E& element) {
return set.find(element) != set.end();
} At least for now, I think you're making the right choice in looking to move the set into a variable. |
Reading that file I sent now, I think we should prefer a |
Enumerated
Value constraintsOneOf
Value constraints
Related to: #2646 (comment) , #2646 (comment) , and #2118
Originally posted by @JacquesCarette in #2646 (comment)
The text was updated successfully, but these errors were encountered: