Replies: 3 comments 1 reply
-
The requirement is about using tuple to fill multiple arguments when calling methods. M(..px); A new syntax is probably required to avoid ambiguity. |
Beta Was this translation helpful? Give feedback.
-
Am I wrong that the biggest problem here is that the compiler is supposed to know the value of an object's property? I think it is one thing for it to do that for things like tracking Why would Then again, the idea of just passing tuples in as parameters doesn't seem to provide much value to me anyway. Why do we need that? It seems like it makes the code less clear, in this case the signature of those methods. Do they take one parameter or 3? This isn't problem for deconstructing the return value of a function because you can see exactly what is happening there. Anyway, if we really want this, I agree with @huoyaoyuan and it needs to be at the call site and make it clear(er) what is going on (or at least clear that something is going on). So something like one of the following: M1(px()); // so () after a tuple means "deconstruct" it, or: "as a parameter list"
M1((px)); // the "unnecessary"/"redundant" () _around_ a tuple means "deconstruct" it, or "as a parameter list" |
Beta Was this translation helpful? Give feedback.
-
Add a property called 'Auto Deconstruction' to 'ValueTupe'
like this:
If the custom member name of the 'ValueType' variable does not match the method parameters to be deconstructed, then according to the usual deconstruction practice, the method should also prevail in this case; So the success or failure of automatic deconstruction is not related to the custom names of members, but only to the number, order, and type of members. As long as these three conditions are met, it should be considered a legal deconstruction rule
Example:
Beta Was this translation helpful? Give feedback.
All reactions