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

Replace dynamic type checks with generic overloads #41

Closed
simonjbeaumont opened this issue May 26, 2023 · 1 comment
Closed

Replace dynamic type checks with generic overloads #41

simonjbeaumont opened this issue May 26, 2023 · 1 comment
Assignees
Labels
area/runtime Affects: the runtime library. kind/enhancement Improvements to existing feature. size/S Small task. (A couple of hours of work.)

Comments

@simonjbeaumont
Copy link
Collaborator

A recent PR to the runtime library was fixing an issue for the transcoding of types that have an additional protocol conformance. This was done with a dynamic as? type check and an as! force cast.

In a comment, we discussed a better way: using a specialization and letting the compiler do the work: apple/swift-openapi-runtime#9 (comment).

We approved the PR as-was because it matched the pattern we were using in the rest of the code base and was a targeted fix for an issue.

This issue is to track revisiting the dynamic type checking pattern in all the places its used in the runtime library and adopting the pattern in the linked PR comment.

@simonjbeaumont simonjbeaumont added area/runtime Affects: the runtime library. kind/enhancement Improvements to existing feature. size/S Small task. (A couple of hours of work.) labels May 26, 2023
@simonjbeaumont simonjbeaumont self-assigned this May 26, 2023
@czechboy0 czechboy0 changed the title runtime: Replace dynamic type checks with generic overloads Replace dynamic type checks with generic overloads May 27, 2023
@czechboy0
Copy link
Contributor

This is addressed in the latest solution to #43.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runtime Affects: the runtime library. kind/enhancement Improvements to existing feature. size/S Small task. (A couple of hours of work.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants