-
Notifications
You must be signed in to change notification settings - Fork 581
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 support for switch/match element #1307
Comments
i would say that union/match approach could give the best result (as it is most powerful) - also simple match if there would be per-se enumerations on .slint grammar would be good - something like:
|
How involved is it to build powerful (rust-like) match semantics into C++? |
If the question is how to lower the proposed
would become something like struct Shape_rectangle { float h; float w; };
struct Shape_circle { float r; };
using Shape = std::variant<Shape_rectangle, Shape_circle>; I guess we have no way around creating types and finding name for them, and using |
There doesn't seem to be any difference between this issue and #241, is there? |
#241 is for expressions (within property binding or callback handlers), while this issue is about instantiating elements |
Not to be confused with #241which is about expression in bindings.
It is often desirable to choose a different component base on some condition or value
It would be nice to do
Maybe not switch but match, and could be combined with the for model.
We could also imagine to have an union type with data (similar to rust enums)
(or have enums with data?)
The syntax need to be somehow defined.
The text was updated successfully, but these errors were encountered: