support * in tuples
I've found that I can't type a certain type of code I maintain, where it'd make sense to do so.
operation = ["+"]
operation << 1
operation << 2
I'd like to type this as a tuple of a given type at the head, and variable values of same type at the tail, smth like operation: [String, *Integer], but the parser does not support that.
I understand the motivation. The extension itself looks reasonable, but I'm afraid if further extension is required? Like [String, *Integer, Symbol] or [*Integer, String, *bool].
Do you think having one * types at the end of tuple makes enough sense?
tuple_type ::= `[` _type_ `,` ... `,` _type_ `]` # Closed tuple
| `[` _type_` `,` ... `,` `*` _type_ `]` # Open tuple
I'd follow the ruby rule here, and only allow * at the end, and once. Allows for a simpler implementation perhaps, and you can always consider extensions later on based on demand.