Skip to content

Resolve how BaseReturnCode class will avoid name collisions on the values #2235

Open
@portante

Description

@portante

Taken from code reviews on PR #2222.


Hoisting the mechanism into a base class is good; however, I'm unclear on how we're going to avoid name collisions on the values, and, possibly more important, how we avoid unintentional value collisions. (I.e., prefixing the "kill codes" with KILL_ helps with the naming, but, if I see a value of 2, how do I know that it was BADAGENTCONFIG and not KILL_BADPID?)

Should these values be some sort of an enum class which could/would ensure uniqueness?

Originally posted by @webbnh in #2222 (comment)


I'm unclear on how we're going to avoid name collisions on values

Good question, I'll investigate; one possibility is to employ a unit test to compare the base class codes against the sub-classes to ensure no overlap.

how we avoid unintentional value collisions

The way the ReturnCode "kill" works is it shifts the codes by 1,000.

Originally posted by @portante in #2222 (comment)


OK, so the KILL_ values are a different "type". (One wonders if they shouldn't be in their own IntEnum.)

Originally posted by @webbnh in #2222 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

To Do

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions