opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

[configoptional] Rename `hasValue` and `notNone`

Open mx-psi opened this issue 5 months ago • 0 comments
trafficstars

Not something we have to decide here, and it's minor since it's largely internal, but how would you feel about calling this variable hasValue and renaming hasValue to hasSome?

  1. Makes it so that hasValue means there's a default/explicitly-set value associated with an Optional object, through Default, Some, or unmarshaling.
  2. Makes it so hasSome means the Optional object has a value ready for use, through Some or unmarshaling.
  3. The Default function will no longer set a value while setting hasValue: false.
  4. Gets rid of the negative in notNone while keeping our preferred default as the zero value for the field.

My hope is that this would simplify, if only a bit, how we describe the state an Optional object is in. The downside is the name of the HasValue function wouldn't make as much sense anymore, and changing that would be breaking if we do it later, so we'd need to agree this is enough of an improvement to justify that. Also, "some" isn't necessarily a common concept, so perhaps working with "value" and "none" are better.

Originally posted by @evan-bradley in https://github.com/open-telemetry/opentelemetry-collector/pull/13168#discussion_r2135830187

mx-psi avatar Jun 09 '25 16:06 mx-psi