-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate parameter names #4381
Comments
That should surely be an error. I hope this is not a regression... |
I think that has always been the case. Given that you can write On Fri, Jul 3, 2015 at 1:56 PM, Simon Krajewski notifications@github.com
|
It would be cool if the second |
I think especially in case of parameters you just want an error. |
@markknol I would speculate that it's meant to allow for @Simn It seems it can: http://try.haxe.org/#b94fE Slightly off-topic: why was referencing previous variables in the same declaration allowed? I would say I see this: {
var a = exprA, b = exprB;
somethingHere;
} As this: (function (a, b) {
somethingHere;
})(exprA, exprB) So I've always been puzzled by the fact that |
@back2dos Just curious; In which case would you define a function with those underscores? |
I find it natural in a left-to-right kind of way. It's also trivial to generate it to our targets, whereas some swapping behavior would be tricky to get right. |
@markknol Consider a |
@Simn No doubt it is tricky, but you already got it right, given that this works already: {
var x = 5, y = 6;
{
var x = y;
}
{
var y = x;
}
} Anyway, it's nothing we can change any time soon. This thread just reminded me of how odd I find it to be, so I had to ask ^^ |
We could forbid same-function-parameter-name, with the exception of underscore, that sounds like a good middle ground |
Thinking about this now I don't think it's worth disallowing this. Who knows what crazy macro-generated functions might have duplicate argument names somewhere. I also don't think this would catch any programming errors. |
Is this expected behavior?
(http://try.haxe.org/#bdE78)
In other languages you get an error like this:
The parameter name 'a' is a duplicate
.The text was updated successfully, but these errors were encountered: