-
Notifications
You must be signed in to change notification settings - Fork 296
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
Logging function autoclosures aren't "rethrows" #265
Comments
Technically it's API breaking because if you have
then you can do
but not
(because it would drop the |
Hmm, we also can't introduce this via more overloads, that gets ambiguous very quickly. So it's either risking it, or calling a major... This probably isn't worth a major release though. |
Major releases aren't a limited resource. |
They are problematic though for a package such as swift-log that is depended on by almost all high level frameworks and libraries in the server ecosystem, so we need to consider bumping major versions carefully. This isn't quite the same as it is in "leaf" packages. |
we could add a new set of [re]throwing APIs but that will double the API surface area. or we can just add a single
|
Hm yes... I wonder if that's helpful enough, wdyt @sjmadsen ? Personally I'd be interested to see if we'd actually break any oss package.. though ofc closed source users are a risk 🤔 if we did introduce rethrows... we could try to do a "community build" and see what breaks 🤔 |
|
Expected behavior
If I have a throwing function
fn()
or a throwing property accessor, it would be nice if these two log statements work:Actual behavior
Right now it does not compile, giving the error
Property access can throw, but it is executed in a non-throwing autoclosure
.I believe marking the autoclosures with
rethrows
will resolve this problem.Steps to reproduce
try
a logging function with a string interpolation containing a throwing function call or property access.If possible, minimal yet complete reproducer code (or URL to code)
I can provide something if it's really necessary, but I think there is enough information above.
SwiftLog version/commit hash
1.5.2
Swift & OS version (output of
swift --version && uname -a
)swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
Darwin smadsen-MacBook-Pro 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
The text was updated successfully, but these errors were encountered: