> The number represents the character's code.
An expression like
Copy code
if (Char.MAX_HIGH_SURROGATE < Char.MAX_LOW_SURROGATE) {
println("Yes")
}
Will generate
Copy code
Companion_getInstance();
var tmp = _Char___init__impl__6a9atx(56319);
Companion_getInstance();
if (Char__compareTo_impl_ypi4mb(tmp, _Char___init__impl__6a9atx(57343)) < 0) {
println('Yes');
}
I wonder if the compiler can be improved to inline the two numbers.
This is relevant since when we use the characters directly
Copy code
if ('\uDBFF' < '\uDC00') {
println("Yes")
}
We get the JS
Copy code
println('Yes');
j
jw
02/09/2024, 12:14 AM
This is how value types look. Did you try a minified build? Usually they disappear
e
Edoardo Luppi
02/09/2024, 10:14 AM
Well, in case of a Node.js library, builds don't pass by a minifier/bundler, so I'd have to set up an additional step myself, which is something I'd like to have set up by the Kotlin's tooling at some point, not by me.
Edoardo Luppi
02/09/2024, 10:15 AM
The char const val could simply be inlined, so to get the second result, much like what happens with other primitive types
t
turansky
02/09/2024, 3:22 PM
I'd like to have set up by the Kotlin's tooling at some point, not by me.
1. Do you have additional dependencies?
a. Do you need bundle with dependencies inside?
2. Which module kind do you use?
e
Edoardo Luppi
02/09/2024, 4:29 PM
1. Yes / I'd like to bundle in a single package (taking into account the granularity option)
2. CommonJS and ESM