Skip to content

Allow impls and traits having static and instance methods with the same name #4279

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

Closed
wants to merge 1 commit into from
Closed

Allow impls and traits having static and instance methods with the same name #4279

wants to merge 1 commit into from

Conversation

ttaubert
Copy link
Contributor

This fixes all errors described in issue #4265. make check runs successfully on my machine.

r? @brson

@catamorphism
Copy link
Contributor

I reviewed since I suspect not too many other core team members are working on Christmas Eve ;-) Looks good except for my line comment -- if you can fix that and re-push, I'll merge it. Thanks!

@brson
Copy link
Contributor

brson commented Dec 25, 2012

Do we have agreement that this is a desirable feature? Actually defining two methods with the same name seems like something you would never want to do.

@catamorphism
Copy link
Contributor

@brson I thought about that, but is there a specific reason we'd want to rule it out? Is there a scenario where allowing two methods with the same name could confuse somebody?

@brson
Copy link
Contributor

brson commented Dec 25, 2012

@catamorphism Besides making it more difficult to talk about that method with the duplicate name, I don't have any specific problems with it.

This is probably incompatible with @pcwalton's proposal to unify methods and functions.

@ttaubert
Copy link
Contributor Author

@catamorphism Thank you for the quick review!

@brson I agree that this might not be what we want but I figured since we support defining those methods we should also support calling them. OTOH if this really interferes with @pcwalton's proposal (which I think is really nice) we should just fail when we encounter a taken method name.

@pcwalton
Copy link
Contributor

pcwalton commented Jan 9, 2013

I think this interferes incompatibly with my proposal.

@brson
Copy link
Contributor

brson commented Jan 14, 2013

Closing because this prevents the unification of methods and functions per @pcwalton's proposal. Can we fix this issue instead by emitting an error when static and instance methods have the same name?

@brson brson closed this Jan 14, 2013
RalfJung added a commit to RalfJung/rust that referenced this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants