I recall there being some proposal or presentation...
# language-evolution
y
I recall there being some proposal or presentation or something about "extending" builder inference to work more generally for cases like:
Copy code
var x = null
x = 5
So that x gets inferred as
Int?
. I think this was meant to work like builder inference by having a postponed type variable for the type of x, so that the type variable can be inferred as such.I believe this is very similar to OCaml's weak polymorphic types. Anyone remember where that idea was presented/proposed?
s
This video I think:

https://youtu.be/3uNpmhHwkuQ

thank you color 1
At about the 16 min mark
y
Got a strange YouTube Android bug at first where it took me to the Kotlin channel without bringing up the video lol
Thank you for finding it though! That's precisely what I was looking for. It seems very exciting, especially since 1) it should work with error union types and 2) it seems to be general enough to also work for code like:
Copy code
val x = mutableListOf()
x.add(42)
Although this might not be implemented if there's concerns that a function call might need the exact type parameter? I think this'd be the case if we called a
reified
function without having enough info to specify the type (but I think that works with builder inference right now, so maybe I'm just saying things lol)