Skip to content

Conversation

firewave
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator Author

As suggested by @pfultz2 in #6845 (comment).

lib/infer.cpp Outdated

namespace {
struct IntegralInferModel : InferModel {
private:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is private being added? I don't think it's necessary and it's a little confusing since the interface is public.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is so it can only call it through the interface and not on the object it inherits from.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why? Its faster calling it directly(there is no vtable lookup).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In that case - why having an interface?

Also this change is probably pedantic because the callers will never see the actual implementation and only use the interface.

Copy link
Contributor

@pfultz2 pfultz2 Oct 15, 2024

Choose a reason for hiding this comment

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

In that case - why having an interface?

So we can check that the interface is implemented correctly. Also if this is used across TUs we will need the interface, but if its in the same TU we can use a template function and use REQUIRES("T must be an InferModel", std::is_base_of<T, InferModel>) to improve error messages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also if this is used across TUs we will need the interface, but if its in the same TU we can use a template function and use REQUIRES("T must be an InferModel", std::is_base_of<T, InferModel>) to improve error messages.

Interesting point. I was wondering if there was some cleanup which could be done now they are all in the same place. Will look into it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I dropped commit making things private for now.

@firewave firewave marked this pull request as draft October 16, 2024 13:01
@firewave firewave force-pushed the vf-infer branch 2 times, most recently from 9e1a7a7 to 10cf643 Compare February 6, 2025 17:22
@firewave firewave marked this pull request as ready for review February 6, 2025 17:23
@firewave
Copy link
Collaborator Author

@pfultz2 is this still an acceptable change?

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.

2 participants