Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Simplify constructors for Zero #676

Closed
9 of 10 tasks
LVMVRQUXL opened this issue Jul 14, 2024 · 3 comments
Closed
9 of 10 tasks

✨ Simplify constructors for Zero #676

LVMVRQUXL opened this issue Jul 14, 2024 · 3 comments
Assignees
Labels
common Item related to all platforms. feature New feature or request.

Comments

@LVMVRQUXL
Copy link
Contributor

LVMVRQUXL commented Jul 14, 2024

πŸ“ Description

For aligning with our design goals on less is more, we want to provide only constructors for creating an instance of the Zero type in a natural way. These constructors should be accessible from all Kotlin platforms and Java.

Here's the Application Programming Interface (API) goal that we want to achieve with this issue:

class Zero {
    constructor() // Already introduced in v4.5.1.
    constructor(number: Any)
}

These constructors should replace all factory functions introduced previously for the Zero type.

Also, the Zero.Companion.PATTERN property being used only by the constructor(Any) function of the Zero type, we want to remove it from the public experimental API and merge its documentation into this constructor's documentation.

βœ… Checklist

  • ✨ Add the constructor(Any) function with tests, documentation and samples.
  • πŸ“ Update the documentation of the Zero type for removing factory functions other than constructors.
  • πŸ”₯ Remove all other factory functions for the Zero type and unused internals.
  • πŸ“ Update the documentation of the constructor(Any) function for removing usages of the Zero.Companion.PATTERN property.
  • ♻️ Refactor the constructor(Any) function for removing usages of the Zero.Companion.PATTERN property.
  • πŸ”₯ Remove the Zero.Companion.PATTERN property.
  • πŸ”₯ Remove the Zero.Companion type.
  • ♻️ Refactor the constructor(Any) function by introducing an internal InvalidZeroRepresentation type.
  • πŸ“ Update the unreleased changelog for this issue.
  • πŸ’¬ Resolve all comments of this issue.
@LVMVRQUXL LVMVRQUXL added feature New feature or request. common Item related to all platforms. labels Jul 14, 2024
@LVMVRQUXL LVMVRQUXL added this to the 4.5.2 milestone Jul 14, 2024
@LVMVRQUXL LVMVRQUXL changed the title ✨ New constructors for Zero ✨ Simplify constructors for Zero Jul 14, 2024
@LVMVRQUXL LVMVRQUXL self-assigned this Jul 14, 2024
LVMVRQUXL added a commit that referenced this issue Jul 14, 2024
@LVMVRQUXL
Copy link
Contributor Author

LVMVRQUXL commented Jul 14, 2024

After resolving this issue, we will be able to introduce the ZeroAsStringSerializer type in the types-kotlinx-serialization subproject for serializing the Zero type as String. This could be useful for communicating an already formatted zero like 0.00.

@LVMVRQUXL
Copy link
Contributor Author

Using RegExr might be a solution for storing and documenting the regular expression used by the constructor(Any) function.

LVMVRQUXL added a commit that referenced this issue Jul 15, 2024
This commit inlines the `Zero.Companion.PATTERN` constant in the `Zero(Any)` constructor for future removal.
LVMVRQUXL added a commit that referenced this issue Jul 15, 2024
This commit introduces an `InvalidZeroRepresentation` type in the `types-internal` subproject for refactoring the exception message returned by the `Zero(Any)` constructor in case of invalid number.
@LVMVRQUXL
Copy link
Contributor Author

Superseded by #681.

@LVMVRQUXL LVMVRQUXL closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2024
@LVMVRQUXL LVMVRQUXL removed this from the 4.5.2 milestone Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Item related to all platforms. feature New feature or request.
Projects
None yet
Development

No branches or pull requests

1 participant