Operator on tuple #8751
Replies: 9 comments
-
Would applying the operator to tuples of different lengths be allowed? If so, what would be the runtime behavior? |
Beta Was this translation helpful? Give feedback.
-
Forgot that one. Lengths of tuples must be same and it will be checked when compiling. |
Beta Was this translation helpful? Give feedback.
-
Related: #190 |
Beta Was this translation helpful? Give feedback.
-
Which binary operators are you thinking of here? Just If this makes it into the language, it might not take long until someone suggests |
Beta Was this translation helpful? Give feedback.
-
@stakx : Yes, please!! |
Beta Was this translation helpful? Give feedback.
-
@stakx and what happens if the single value of |
Beta Was this translation helpful? Give feedback.
-
@quinmars - I think you know how I meant it. 😆 But for the record, let's say "where In fact, with the above I wanted to show that this proposal for operator I do like this proposal, but I can't help but wonder whether the request for these kind of operations on tuples have a mostly numerical / mathematical background, in which case it might be better to use |
Beta Was this translation helpful? Give feedback.
-
A tuple is not a mathematical vector, and we should be careful not to confuse the two. |
Beta Was this translation helpful? Give feedback.
-
This is in line with the principle that operations on a tuple should be distributive to its elements. I like it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Like Nullable supports operators defined at T, Tuple can be.
Example:
Could be
Even if types of all elements in tuple is not identical operator can be used if all types override specific operator.
Beta Was this translation helpful? Give feedback.
All reactions