Skip to content

infer_return_type: simplify definition, use less-private interface #12

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

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented May 26, 2025

The Base.promote_op function seems to be less private of an interface than Compiler.return_type. While the single method defined in Base basically just forwards to Compiler.return_type (for the purposes of StableTasks), the semantics are a bit different because a handful of packages actually add other methods to this function. That seems like a good thing, though.

While at it, also avoid defining a new function, instead just assign the callable to a constant binding. Should help code coverage.

The `Base.promote_op` function seems to be less private of an interface
than `Compiler.return_type`. While the single method defined in `Base`
basically just forwards to `Compiler.return_type` (for the purposes of
StableTasks), the semantics are a bit different because a handful of
packages actually add other methods to this function. That seems like
a good thing, though.

While at it, also avoid defining a new function, instead just assign
the callable to a constant binding. Should help code coverage.
@nsajko
Copy link
Contributor Author

nsajko commented May 26, 2025

While promote_op is not public:

@MasonProtter
Copy link
Member

I don't like promote_op because it's designed to be overloadable. In many cases that's an advantage, people should be able to tell promote_op things about their function, but I see that as only a negative in the case of StableTasks. I really don't want to get some weird, wrong, or even right answer because someone added a method to promote_op.

@nsajko nsajko closed this May 26, 2025
@nsajko nsajko deleted the promote_op branch May 26, 2025 18:54
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