Youssef Shoaib [MOD]
02/25/2024, 9:08 PMinline
behaviour in Scala? Does something like this just work?
inline def forEach(inline block: Int => Unit): Unit
With block
getting mentioned only once insideephemient
02/26/2024, 1:26 PMYoussef Shoaib [MOD]
02/26/2024, 1:27 PMmap
s for instance in Scala, or a for-each, but without a closure actually being createsephemient
02/26/2024, 1:27 PMassert
is hard-wired in the compiler to be lazy in its argument but otherwise there isn'tephemient
02/26/2024, 1:27 PMephemient
02/26/2024, 1:28 PMYoussef Shoaib [MOD]
02/26/2024, 1:28 PMinline
gives me that in Kotlin, so I'm hoping that there's an equivalent in Scala, and figured if anyone would know it would be people hereephemient
02/26/2024, 1:30 PMYoussef Shoaib [MOD]
02/26/2024, 1:33 PMQuotes
stuff?
inline def forEach(inline block: Int => Unit): Unit
Also I'm guessing there's no nice (and performant) way to do non-local returns, so I would likely need to have block
return whether to keep iterating or notephemient
02/26/2024, 1:35 PMKlitos Kyriacou
02/26/2024, 3:56 PMThat's only in Java, not in Kotlin.is hard-wired in the compiler to be lazy in its argumentassert
ephemient
02/26/2024, 4:05 PMKlitos Kyriacou
02/26/2024, 4:07 PMfun main(args: Array<String>) {
assert(false.also { print("A") } )
println("B")
}
ephemient
02/26/2024, 4:08 PM-Xassertions=jvm
isn't default, but it is the default (only) behavior on native and js