Skip to content

[Task]: Remove shackles on Base Unit constructos #43

@Sefford

Description

@Sefford

Task Summary

Remove shackles on Base Unit constructos

Context / Background

Description:
Currently, several unit classes in KISU enforce value constraints (e.g., Temperature does not allow negative Kelvin values) directly in their constructors. While this enforces correctness early, it limits the ability to perform operations like deltas or intermediate calculations where such values may be temporarily valid.

This approach increases flexibility and aligns better with mathematical operations, testing, and Kotlin idioms.

Proposed Steps or Checklist

  • Remove validation logic from constructors (e.g., no more require(value >= 0)).
  • Move these constraints into dedicated validation functions or extension methods.
  • Consider providing factory methods for safe construction, such as Kelvin.requireValid(value)

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions