Siegfried Kiermayer
06/10/2023, 10:14 AM@Enumerated(EnumType._STRING_)
@Column(name = "base_currency", columnDefinition = "currency_code")
@Type(PostgreSQLEnumType::class)
var baseCurrency: CurrencyCode? = null
holgerbrandl
06/10/2023, 10:29 AMfun createSimulation(
@Deprecated("use env.enableConsoleLogger() instead")
enableConsoleLogger: Boolean = false,
durationUnit: DurationUnit = MINUTES
){ print() }
It seems that the @Deprecated is not applicable for parameters.
Thread in Slack ConversationColton Idle
06/10/2023, 7:01 PMclass SomeUtil {
fun findPercentage(x: Int, y: Int, z: Int)
but something like this
object SomeUtil {
fun findPercentage(x: Int, y: Int, z: Int)
is also convenient + less object allocation because I dont have to do SomeUtil() every time I want to use it.
I suppose another potential is creating an extension function, but in this case since I have three args... I don't think that'd work?
In this scenario would you do
1️⃣ Class
2️⃣ Object
3️⃣ Something elsePihentagy
06/13/2023, 2:50 PMkotlinx.coroutines.async
?
I have now:
dependencies {
implementation ("org.jetbrains.kotlin:kotlin-stdlib")
implementation ("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
Donny
06/13/2023, 9:01 PMSteven Shaw
06/13/2023, 11:07 PMwhen
..is
). AFAICS, pattern match is superior in Java. Am I missing something? Are improvements on the roadmap?mohamed rejeb
06/14/2023, 8:39 AMMuhammad Rohadi(Adi)
06/14/2023, 12:55 PMribesg
06/14/2023, 1:48 PMMichael Knudson
06/15/2023, 12:13 AMSlackbot
06/15/2023, 10:00 PMmartmists
06/17/2023, 9:19 AMclass ComposableRenderer : engine.components.ComposableRenderer {
// ...
override var renderComposable by setOnce<@Composable () -> Unit>() // setOnce defines getValue and setValue
}
Results in a strange error:
Caused by: java.lang.AbstractMethodError: Receiver class engine.runtime.components.ComposableRenderer does not define or inherit an implementation of the resolved method 'abstract void setRenderComposable(kotlin.jvm.functions.Function2)' of interface engine.components.ComposableRenderer.
But shouldn't specifying it as var
make it generate a setter?jean-paul
06/18/2023, 3:27 AMNot enough information to infer type variable V
the highlight being on the 'mapOf'.Ali Shirvani
06/18/2023, 4:27 AMRun/Debug Configurations
only contains Environment Variables
.Shalom
06/18/2023, 10:03 AMJohann Pardanaud
06/18/2023, 8:43 PMclass Wrapper<T>(val wrappedValue: T, parent: Wrapper<*>? = null)
fun <T : Any?, V> Wrapper<T>.wrapperOf(getter: KProperty1<T & Any, V>): Wrapper<V?> {
return Wrapper(wrappedValue?.let { getter.get(it) }, this)
}
fun main() {
// does not compile
Wrapper("foo" as String?).wrapperOf(String::length)
// but compiles with an intermediate variable
val getter = String::length
Wrapper("foo" as String?).wrapperOf(getter)
}
Link to the playground
If I comment the eleventh line, it compiles, despite using nearly the same code just below but with an intermediate value.
What do you think? Am I missing something?Marcus Cvjeticanin
06/19/2023, 7:55 AMErik
06/19/2023, 12:44 PMval totalSize = (list1?.size ?: 0) + (list2?.size ?: 0)
I'm wondering if there is a more idiomatic, easier to read syntaxDonny
06/19/2023, 5:55 PMmcampbell
06/19/2023, 7:37 PMy
06/20/2023, 7:39 AMvalue class
, is there any disadvantage to doing it? assuming you already know ahead of time that you won't need additional properties.Adam S
06/20/2023, 12:04 PMfun main() {
val r = Regex("""\h+([^:\v]+):""")
println(r.matchEntire(" Version:")?.groupValues)
// JVM: [ Version:, Version]
// JS: SyntaxError: Invalid regular expression: /\h+([^:\v]+):/gu: Invalid escape
}
https://pl.kotl.in/HwXS2Fv3u
EDIT: Ahh, never mind. \h
(horizontal whitespace) doesn’t exist in JS. I’ll try replacing it with
[\t\x{00A0}\x{1680}\x{180E}\x{2000}\x{2001}\x{2002}\x{2003}\x{2004}\x{2005}\x{2006}\x{2007}\x{2008}\x{2009}\x{200A}\x{202F}\x{205F}\x{3000}]
(as found on https://regex101.com/)
further suggestions are welcome!Luiz Aguiar
06/21/2023, 10:08 AMLukasz Kalnik
06/21/2023, 1:29 PMinternal class Outer {
class Inner
}
is the Inner
class public
or also internal
?Ashish Choudhary
06/22/2023, 9:30 AMBilly Newman
06/22/2023, 2:54 PMSayali N
06/22/2023, 3:44 PMĐỗ Thành Đạt
06/22/2023, 5:01 PMMatas Lauzadis
06/22/2023, 7:35 PMkotlin.time
APIs are going stable in 1.9.0?Johann Pardanaud
06/22/2023, 9:48 PM@JvmInline
value class Wrapper(val value: CharSequence) : CharSequence by value
Here, since the inline class and its underlying value both implement the CharSequence
interface, I could write either:
val wrappedValue: CharSequence = Wrapper("foo")
// OR
val wrappedValue: CharSequence = "foo"
But, in the first case, the value seems to be boxed:
@NotNull
private static final CharSequence wrappedValue = Wrapper.box-impl(Wrapper.constructor-impl((CharSequence)"foo"));
There is probably a reason, but I don't get it. 🤔