kotools / types

Explicit types for Kotlin Multiplatform.
https://types.kotools.org
MIT License
90 stars 6 forks source link

✨ New constructors for `Zero` #670

Closed LVMVRQUXL closed 4 months ago

LVMVRQUXL commented 5 months ago

📝 Description

For maintaining a good design for Kotlin and Java users, we want to replace existing factory functions by constructors and orNull factory functions. New constructors should be accessible easily from Kotlin and Java code, but orNull factory functions should be only accessible from Kotlin code.

Here's the Application Programming Interface (API) goal:

class Zero {
    constructor()
    constructor(number: Byte)
    constructor(number: Short)
    constructor(number: Int)
    constructor(number: Long)
    constructor(number: Float)
    constructor(number: Double)
    companion object {
        @JvmSynthetic fun orNull(number: Byte): Zero?
        @JvmSynthetic fun orNull(number: Short): Zero?
        @JvmSynthetic fun orNull(number: Int): Zero?
        @JvmSynthetic fun orNull(number: Long): Zero?
        @JvmSynthetic fun orNull(number: Float): Zero?
        @JvmSynthetic fun orNull(number: Double): Zero?
    }
}

✅ Checklist

LVMVRQUXL commented 4 months ago

Superseded by #674.