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

fix: Default-implement memorySize via Swift extension #497

Merged
merged 5 commits into from
Jan 14, 2025

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Jan 14, 2025

Instead of re-implementing memorySize in every _base class, I can provide a shared default-implementation for it using a Swift protocol extension.
I found this out by accident by talking to ChatGPT about dynamic dispatch in Swift.

This is statically resolved at compile-time if it isn't overridden, so it's also more performant.

Warning

If anyone uses memorySize, they just need to remove the override keyword.

Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
nitro-docs ⬜️ Skipped (Inspect) Jan 14, 2025 10:38am

@mrousavy mrousavy merged commit 3f04c15 into main Jan 14, 2025
9 checks passed
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