ansman
04/21/2025, 11:59 PMfun foo(content: context(String, String) () -> Unit) {
content("", "")
}
fun test() {
foo {
// Does not work: Multiple potential context arguments for 'String' in scope.
implicit<String>()
}
}
Daniel Pitts
04/27/2025, 6:50 PMpackage foo.bar
data object Constants {
val first = 1
val second = 2
}
Main.kt
import foo.bar.Constants.*
fun main() {
println("$first is first. $second is second.")
}
Kelvin Chung
04/29/2025, 7:31 PMArjan van Wieringen
05/07/2025, 5:28 PMJP Sugarbroad
05/07/2025, 6:14 PMasync let
and I really want it: https://blog.yoshuawuyts.com/automatic-interleaving-of-high-level-concurrent-operations/phldavies
05/12/2025, 10:26 AMcontext-parameters
(2.2.0-Beta2) is it expected to be ambiguous in the call to helloContext
when nested inside two applicable scopes? I would have expected it to resolve the same way as the receiver case (that is, with the closest applicable candidate taking priority, given you can disambiguate to the outer scope explicitly with a with(this@outer)
or context(this@outer)
)
(snippet in thread - slack went weird and thought it was a binary)Youssef Shoaib [MOD]
05/14/2025, 12:39 PM@RestrictsSuspension
? I want to do something like:
context(s: SequenceScope<Int>)
suspend fun Int.yield() = s.yield(this)
but it errors.Jason Zhao
05/20/2025, 11:36 PMShaun Wild
05/21/2025, 5:17 PMYoussef Shoaib [MOD]
05/25/2025, 8:32 PMYoussef Shoaib [MOD]
05/26/2025, 4:38 AMCLOVIS
05/26/2025, 5:03 PMerror object First
error object Second
val a: Int|First = TODO()
val b: Int|First|Second = foo(a)
fun <E : Error> foo(e: Int|E): Int|E|Second // ?
Will this be legal?jobot0
05/27/2025, 8:01 AMYoussef Shoaib [MOD]
05/27/2025, 12:11 PM@RestrictsSuspension
a bit, and I'm coming to the conclusion that it effectively implements resource/capability tracking, but restricted to 1 type, and while also interacting with suspend and the generated code in the obvious ways.
I wonder if its implementation could be generalized to a frontend-only, multiple capability implementation, especially with context parametersCLOVIS
05/27/2025, 7:14 PMEdoardo Luppi
05/29/2025, 9:18 AMCLOVIS
05/29/2025, 4:03 PMfun foo(range: ClosedRange<*>) {}
fun foo(range: OpenEndRange<*>) {}
foo(5..12)
gets
Overload resolution ambiguity between candidates
because IntRange
is both ClosedRange
and OpenEndRange
… It's a shame because the behavior would be exactly the same no matter which one the compiler chose.
Is there another solution other than creating a new overload of foo
for ByteRange
, ShortRange
, IntRange
and LongRange
, and also all the unsigned ones?mikhail.zarechenskiy
06/03/2025, 8:39 AMPerson(@Email val email: String)
, the @Email
annotation would be applied to both the constructor parameter and the field, while today it only applies to the parameter. This change seems safe and reasonable, and was originally motivated by KT-19289
At the same time, we’ve been considering a more aggressive default: applying annotations to all applicable targets. For instance, in @Anno var x: String
, the annotation could be applied to the property, backing field, getter, setter parameter, and so on. This is similar to how annotations work for records in Java.
Initially, we were cautious about this idea, we thought it might break some frameworks. But based on recent conversations, it seems this concern may not be as serious as we thought. Perhaps we should move toward this broader default after all. So I wonder if you could share your thoughts and any known pitfalls of changing the default.
What do you think?CLOVIS
06/05/2025, 12:49 PMerror data object NotFound
and all firstOrNotFound
, firstOfOrNotFound
etc variants?
The KEEP mentions how the language will change, but I didn't see anything about the changes to the standard library.Youssef Shoaib [MOD]
06/05/2025, 4:37 PMAlejandro Serrano.Mena
06/06/2025, 9:14 AMcketti
06/06/2025, 12:13 PM"\u{1F995}"
instead of "\uD83E\uDD95"
or "🦕"
. Granted, often it's preferable to use the last variant. But there are cases where (programming) fonts are missing glyphs or the code point isn't associated with a visible character. In such cases, having to use escapes of the surrogate characters just doesn't make for a great developer experience.
Does this sound like something that has a chance of being added to the language? Or would I be wasting my time if I wrote up a KEEP? (I already have a prototype to add support to the compiler.)Edoardo Luppi
06/09/2025, 1:46 PMYoussef Shoaib [MOD]
06/11/2025, 2:13 AMsuspendCoroutineUninterceptedOrReturn
and startCoroutineUninterceptedOrReturn
? That'd require making COROUTINE_SUSPENDED
an Error type, which is hard since it's currently an enum
member for serialisation's sake.
I imagine, because this is an intrinsic, it doesn't matter muchjNayden
06/11/2025, 6:41 AMrnett
06/16/2025, 6:37 AMlocal
parameters mentioned in the outference talk? I was not able to find any myselfYoussef Shoaib [MOD]
06/17/2025, 7:37 PMInlineOnly
.vngantk
06/20/2025, 10:22 PMGhasem Shirdel
06/27/2025, 2:46 PMRafael Diaz
06/29/2025, 9:36 PMinternal
modifier but with the possibility to scope to multiple modules. I figure it's probably a niche request so I was wondering how other people have handled the situation.