slashmo / gsoc-swift-baggage-context

BaggageContext library, extracted from slashmo/gsoc-swift-tracing
https://github.com/slashmo/gsoc-swift-tracing
Apache License 2.0
4 stars 2 forks source link

Semantically helpfully named empty baggage factory functions #26

Closed ktoso closed 3 years ago

ktoso commented 3 years ago

Similar to Go, it could explain to people what they should do when a task starts "from zero" in "the background" somewhere.

Go does:

both return empty context but they are easier to write code analysis for -- e.g. "don't release with TODO() contexts". I think this would be quite useful since you can prototype easily with TODO() and then you can add it around for real everywhere.

ktoso commented 3 years ago

Not sure if we should hide init() then as well yet...

slashmo commented 3 years ago

Agreed. I think, as you mentioned, both improve the readability and are better options than .empty.

Not sure if we should hide init() then as well yet...

In case we have both "wrappers" in place I don't see a reason to make the BaggageContext init more than private.