Enumeration Sub Set Type #961
gingerBill
started this conversation in
Ideas/Requests
Replies: 1 comment
-
I would suggest adding the abilty to create a set by merging other sets. i.e: Something along these lines: Err :: enum {Ok, A, B, C, D};
First_Err :: type_set[Err]{.Ok, .A, .B}
Sec_Err :: type_set[Err]{.Ok, .C, .D}
First_Or_Sec_Err :: First_Err || Sec_Err;
f :: proc() -> First_Or_Sec_Err {
first_err := get_first(); // returns a `First_Err`
if first_err != .Ok {
return first_err; // fine
}
sec_err := get_second(); // returns a `Sec_Err`
if sec_err != .Ok {
return sec_err; // also okay.
}
return .Ok;
} This would mean that a procedure that does a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
The ability to create an enumerator sub set type.
This is to allow a specific degenerate case of enumeration types for specific procedures.
A good use case would be a general error code type for a package, but different procedures explicit state what they could return.
Describe the solution you'd like
NOT FINALIZED SYNTAX:
Beta Was this translation helpful? Give feedback.
All reactions