Skip to content
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

TypeGraph: Rename visit(Type) functions to accept(Type) #217

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

ajor
Copy link
Contributor

@ajor ajor commented Jul 7, 2023

visit(Type&) and visit(Type*) were helper functions than did cycle detection and provided nicer syntax for the type.accept(*this) calls.

However, because they overloaded the visit() function, it was easy to accidentally call a concrete visit method (e.g. visit(Class&)) instead of the virtual-dispatching visit(Type&).

By changing the name of this wrapper, it will make it much more obvious when code is introduced which bypasses the cycle detection.

visit(Type&) and visit(Type*) were helper functions than did cycle
detection and provided nicer syntax for the type.accept(*this) calls.

However, because they overloaded the visit() function, it was easy to
accidentally call a concrete visit method (e.g. visit(Class&)) instead
of the virtual-dispatching visit(Type&).

By changing the name of this wrapper, it will make it much more obvious
when code is introduced which bypasses the cycle detection.
Copy link
Contributor

@JakeHillion JakeHillion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love making overloads explicit, nice!

@ajor ajor merged commit 56b5873 into facebookexperimental:main Jul 7, 2023
@ajor ajor deleted the type-graph-visit-accept branch July 7, 2023 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants