Skip to content

Inconsistent usage of bool as success indicator corrupting documentation. #2308

@mtszkarbowiak

Description

@mtszkarbowiak

Issue Description

bool as a success indicator is used inconsistently across the engine. This leads to major discrepancies between the docs and the code.

/// <returns>True if cannot remove item from the collection because cannot find it, otherwise false.</returns>

Suggested Solution

Imho both .NET (true is success) and native (false is no-issue status code) approaches have their pros and cons. I suggest reserving bool itself for .NET-style and introduce a special type to wrap status codes, whenever they are preferred.

const bool done = TryDotNetStyle();
const StatusCode statusCode = TryCodesStyle();
const bool done = TryCodesStyle() == StatusCode::Success;
const bool done = IsSuccess(TryDocesStyle());
// etc.

Additionally, StatusCode wrapper could reserve more bytes so, whenever used, they can express more states.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions