Skip to content

Conversation

euanh
Copy link
Collaborator

@euanh euanh commented Jul 7, 2025

Motivation

Return type overloads can be puzzling for new readers because the same function call returns a different type depending on where it is called. In some cases a type annotation is needed at the call site, but when the overloaded function is the final call in another function the compiler can infer the type, so the reader needs to know to check the type of the enclosing function.

In addition, in a future pull request we will need access to the underlying data returned by the HTTP client, in order to verify digests and create ContentDescriptor objects. This refactoring starts to prepare for that and makes the code easier to understand.

Modifications

  • Remove return-type overloaded version of executeRequestThrowing()
  • Remove return-type overloaded version of getBlob()

Result

Refactoring. No functional change.

Test Plan

Existing tests continue to pass.

@euanh euanh added kind/enhancement New feature or request semver/patch No public API change. labels Jul 7, 2025
@euanh euanh force-pushed the digest-refactor branch 3 times, most recently from 7fd6e41 to 3005405 Compare July 8, 2025 13:05
@euanh euanh force-pushed the digest-refactor branch 2 times, most recently from 2e4df6a to d6374b5 Compare July 8, 2025 13:19
@euanh euanh changed the title ContainerRegistry: Return a ContentDescriptor from putManifest() ContainerRegistry: Remove return-type overloaded client functions Jul 8, 2025
@euanh euanh merged commit 8f9ae3f into apple:main Jul 8, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant