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

Improve Type Verification #225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Improve Type Verification #225

wants to merge 1 commit into from

Conversation

cfis
Copy link
Collaborator

@cfis cfis commented Nov 21, 2024

It turns out immediate Type verification when calling define_method, define_attr, define_enum, define_iter doesn't work on large C++ code bases because of C++ forwarding support.

Therefore instead of immediately failing, this commit updates the TypeRegistry to track undefined types. Then when figure_type is called for the first time, which will happen when Ruby calls a C++ function that returns an object, the TypeRegistry will check the undefined types. If any still remain undefined, because they are not in the list of defined types, it will throw will throw an exception.

So if an exception is thrown it should hopefully happen almost immediately at program startup and not at some random point in the future when a method with an undefined type is called.

@cfis cfis force-pushed the type_verification branch 2 times, most recently from eddeead to bdf5db3 Compare November 22, 2024 04:47
…define_attr, define_enum, define_iter doesn't work on large C++ code bases because of C++ forwarding support.

Therefore instead of immediately failing, this commit updates the TypeRegistry to track undefined types. Then when figure_type is called for the first time, which will happen when Ruby calls a C++ function that returns an object, the TypeRegistry will check the undefined types. If any still remain undefined, because they are not in the list of defined types, it will throw will throw an exception.

So if an exception is thrown it should hopefully happen almost immediately at program startup and not at some random point in the future when a method with an undefined type is called.
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.

1 participant