Something that could “help” improve some scenarios...
# language-proposals
s
Something that could “help” improve some scenarios using DSL would be to possibly infer the receiver for infix function when the receiver is “directly” available, for example:
Copy code
class SomeClass() {
    infix fun SomeClass.someFunction (someParam: SomeType) {
        // some code
    }
}

fun inSomeClass(action: SomeClass.() -> Unit) {
    SomeClass().action()
}

inSomeClass { 
    this someFunction "param"
    someFunction "param" // Receiver could possibly implied
}
l
A less confusing approach already exists:
someFunction(param)
works, even if the function has the
infix
modifier. I'm wondering about the implications of having this "prefix" syntax and the impact on code readability and correctness.
s
In a DSL context, i could imagine being able to skip
this
would be nice to have. I think it would be similar to the way we can use extensions without explicitly specifying the receiver
this
for example:
Copy code
someInstance.apply{
      someExtension("someParam")
      this.someExtension("someParam")
}
Given that the receiver is unambiguous in this case, i would think it would not have much of a negative impact imho