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

✨ New NotBlankString.Companion.create* factory functions #341

Closed
3 tasks done
Tracked by #541 ...
LVMVRQUXL opened this issue Dec 14, 2023 · 4 comments
Closed
3 tasks done
Tracked by #541 ...

✨ New NotBlankString.Companion.create* factory functions #341

LVMVRQUXL opened this issue Dec 14, 2023 · 4 comments
Assignees
Labels
common Item related to all platforms. feature New feature or request.
Milestone

Comments

@LVMVRQUXL
Copy link
Contributor

LVMVRQUXL commented Dec 14, 2023

📝 Description

We would like to add create* experimental factory functions to the NotBlankString.Companion type for all platforms with the following signature:

fun NotBlankString.Companion.create(value: Any?): NotBlankString
fun NotBlankString.Companion.createOrNull(value: Any?): NotBlankString?

The NotBlankString type being incompatible with Java due to its declaration as inline value class, these functions shouldn't be available for Java users.

✅ Checklist

  • Add the create function, document it, test its behavior with Kotlin, update the public API binaries and the unreleased changelog.
  • Add the createOrNull function, document it, test its behavior with Kotlin, update the public API binaries and the unreleased changelog.
  • Close this issue as completed and update tracking ones if present.
@LVMVRQUXL LVMVRQUXL added feature New feature or request. common Item related to all platforms. labels Dec 14, 2023
@LVMVRQUXL LVMVRQUXL changed the title New constructor-like function for NotBlankString New factory functions for NotBlankString Dec 14, 2023
@LVMVRQUXL LVMVRQUXL modified the milestones: 4.3.2-RC3, 4.3.2-RC2, 4.3.2-RC1, 4.3.2 Dec 14, 2023
@LVMVRQUXL

This comment was marked as outdated.

@LVMVRQUXL LVMVRQUXL modified the milestones: 4.3.2, 4.4.0 Dec 18, 2023
@LVMVRQUXL LVMVRQUXL changed the title New factory functions for NotBlankString New static factory function named of for NotBlankString Dec 21, 2023
@LVMVRQUXL LVMVRQUXL changed the title New static factory function named of for NotBlankString New static factory function for NotBlankString Dec 22, 2023
@LVMVRQUXL LVMVRQUXL changed the title New static factory function for NotBlankString New factory function NotBlankString.Companion.from Dec 22, 2023
@LVMVRQUXL LVMVRQUXL modified the milestones: 4.4.0, 4.4.1 Dec 28, 2023
@LVMVRQUXL LVMVRQUXL changed the title New factory function NotBlankString.Companion.from New NotBlankString.Companion.create* factory functions Jan 7, 2024
@LVMVRQUXL LVMVRQUXL added this to the 4.4.1 milestone Jan 7, 2024
@LVMVRQUXL
Copy link
Contributor Author

We should wait for the issue #371 to be resolved before implementing this one.

@LVMVRQUXL LVMVRQUXL removed this from the 4.4.1 milestone Jan 25, 2024
@LVMVRQUXL LVMVRQUXL added this to the 4.5.0 milestone Jan 29, 2024
@LVMVRQUXL LVMVRQUXL self-assigned this Feb 1, 2024
LVMVRQUXL added a commit that referenced this issue Feb 1, 2024
This function is currently experimental and not available for Java users due to the declaration of NotBlankString as inline value class.

Refs: #341, https://kotlinlang.org/docs/inline-classes.html
LVMVRQUXL added a commit that referenced this issue Feb 3, 2024
This commit updates the documentation of the 'create(Any?)' and the 'createOrNull(Any?)' functions of the 'NotBlankString.Companion' type.

Refs: #341
@LVMVRQUXL LVMVRQUXL changed the title New NotBlankString.Companion.create* factory functions ✨ New NotBlankString.Companion.create* factory functions Feb 28, 2024
@LVMVRQUXL

This comment was marked as duplicate.

@LVMVRQUXL
Copy link
Contributor Author

📝 Description

While accepting a nullable object can be useful in some specific situations, it may be confusing for users. Why creating an instance of NotBlankString from null in Kotlin code or in Java code? We don't know.

This is not because we can call the Any?.toString() function that we should do it!

So, we would like to change the type of the value argument from Any? to Any.

fun NotBlankString.Companion.create(value: Any): NotBlankString
fun NotBlankString.Companion.createOrNull(value: Any): NotBlankString?

✅ Checklist

  • Update the create function, its Kotlin tests, the public API binaries and the unreleased changelog.
  • Update the createOrNull function, its Kotlin tests, the public API binaries and the unreleased changelog.
  • Close this issue as completed and update tracking ones if present.

This comment was moved to the #541 issue.

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