-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
dd96d4c
to
71385b4
Compare
71385b4
to
f82b55d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments in-line, shaping up well.
We should also document this tradeoff but perhaps we can do a big documentation day one day soon... we should write up a "pitch" and overall design info in README -- we can do that as one big task soon
/// This is a "magic value" that is used to enable the KeyPath based accessors to specific attributes. | ||
/// This value will never be stored or returned, and any attempt of doing so would WILL crash your application. | ||
case __namespace | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we should do this about the enum case; keep it in, even if we dont use it.
Also, we should see if we can remove this __namespace -- it's a bit of a hack.
Can you make a ticket for it? "See if we can remove the case __namespace in attributes"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this out on purpose because it's not being used anywhere but the 5.2 "magic". What would be the benefit of leaving it in for < 5.2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a library that supports all swift versions, and they happen to switch over the attributes enum, then they'd be unable to write ONE switch implementation that works on all compiler versions without using default
since they have to handle __namespace
on 5.2+ and they couldn't handle it on previous versions because it's compiled out.
We should keep enums always the same across all supported compiler versions
@@ -353,7 +363,33 @@ public struct SpanAttributes: Equatable { | |||
where Namespace: SpanAttributeNamespace { | |||
SpanAttribute.__namespace[keyPath: dynamicMember] | |||
} | |||
} | |||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the entire type? can we not #if only the "offending" subscript?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slightly more than just the subscript. Prior to 5.2 we e.g. won't need @dynamicMemberLookup
on SpanAttributes
, right? Also, subscript(_ name: String)
in the case of < 5.2 doesn't need to handle __namespace
.
@@ -128,9 +129,11 @@ final class SpanTests: XCTestCase { | |||
XCTAssertEqual(attributes.name, SpanAttribute.string("kappa")) | |||
XCTAssertEqual(attributes.name, "kappa") | |||
XCTAssertEqual(attributes.sampleHttp.statusCode, 200) | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#else
print some info about shy this is skipped?
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "print"? Something like #warning
or an actual runtime print
, or simply a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant print("oh oh")
to be honest :)
In my own test suites I usually print something in yellow for such tests...
but either's fine really
efd52c2
to
d87b196
Compare
@ktoso Feel free to squash this one if accepted. Had some smaller commits fixing up unit tests / CI. |
This is LGTM once the enum __namespace is not excluded 👍 |
Adds support for Swift 5.0 & Swift 5.1 which is necessary for being integrated by other libraries that still support these versions. The CI now executes tests in parallel on 5.0.3, 5.1, and 5.2.