Allow params keyword in some cases even if it is not the last parameter #4658
Unanswered
gurkantuna
asked this question in
Language Ideas
Replies: 1 comment 1 reply
-
See: #1458 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am aware that in the following usage, the compiler is waiting for the
params
keyword as the last parameter to find out which parameter is the beginning of the array.Also, like the compiler, I cannot predict how to find start/end of array with the usage of as follows and I agree with it :)
But what if we change the type of the parameter?
If you show me this, I would think the
int
array starts from the third parameter. But the truth is, although I can tell the end of the arrays, I don't expect the compiler to do that.Above methods cannot be compiled caused by my wrong usage :
Can be compiled in the following case, but I think it's pointless to use an optional parameter since the parameter has to be passed.
So I think the following usage is deterministic as the last parameter is already of boolean type. I mean, I just want to use the ``Bar` method like this :
Maybe I'm missing something, but I think this usage should be allowed in the language.
P.S. My suggestion is, of course, eligible for only the non-object types and different types of non-consecutive parameters.
Beta Was this translation helpful? Give feedback.
All reactions