types icon indicating copy to clipboard operation
types copied to clipboard

🚚 `Integer` - Name collision with Java

Open LVMVRQUXL opened this issue 2 months ago • 2 comments

📝 Description

Problem: We've introduced the org.kotools.types.Integer type in #880 for representing an integer on JVM, JS and Native platforms. But on JVM, Java also provides the java.lang.Integer type for wrapping the primitive type int in an object. This degrades the developer experience in IDEs when typing the type's name provided by Kotools Types.

Solutions:

  1. Provide a type-alias on JVM platform. Candidates: KTInteger or KTInt (KT for Kotools Types, inspired from Apple NS* and CF* declarations).
  2. Rename the org.kotools.types.Integer type on JVM, JS and Native platforms. Candidates: BigInteger or BigInt (suggested by @CLOVIS-AI respectively on Slack and here), KTInteger or KTInt.

Workaround: Import the org.kotools.types.Integer type before using it.

import org.kotools.types.Integer

API:

package org.kotools.types

class Integer

LVMVRQUXL avatar Oct 31 '25 10:10 LVMVRQUXL

Personally I'm in favor of BigInt. I think it's well established in most programming languages that fixed-sized numbers have a simple name and dynamic-sized numbers are prefixed with Big.

I originally proposed BigInteger for JVM similarity, but Kotlin just calls it Int so I think BigInt is better.

I honestly don't find the name "beautiful", I think LargeInt or DynamicInt sounds better. However, I know that if I go up to any software developer and say "Kotools type has a BigInt", 95% of them already know exactly what this is without any additional explanations.

CLOVIS-AI avatar Oct 31 '25 11:10 CLOVIS-AI

Personally I'm in favor of BigInt. I think it's well established in most programming languages that fixed-sized numbers have a simple name and dynamic-sized numbers are prefixed with Big.

I originally proposed BigInteger for JVM similarity, but Kotlin just calls it Int so I think BigInt is better.

I honestly don't find the name "beautiful", I think LargeInt or DynamicInt sounds better. However, I know that if I go up to any software developer and say "Kotools type has a BigInt", 95% of them already know exactly what this is without any additional explanations.

@CLOVIS-AI Thanks for your suggestion.

I agree on the fact that BigInt is a well established name in software programming.

On Kotlin/JS, no BigInt type is available in the IDE by default. But for web projects using Kotlin Wrappers, users will have a name collision with the provided BigInt type.

Still, I will add it to the candidates for this issue.

LVMVRQUXL avatar Oct 31 '25 18:10 LVMVRQUXL