Like Kotlin, Swift supports implicit self/this. I ran a poll over in the Swift forums to see who embraced implicit, and who embraced explicit. I honestly expected implicit to be +95%. I was surprised that the breakdown was 29% explict, 71% implicit, out of 140 votes. I'm curious what the breakdown is in the Kotlin crowd.
Poll: Implicit this = 🔵 (
:large_blue_circle:
), Explicit this = 🟩 (
:large_green_square:
)
🔵 40
🟩 1
a
Ayfri
07/29/2021, 10:04 PM
What is the difference between both ?
b
Big Chungus
07/29/2021, 10:20 PM
this.someProp (explicit) vs someProp (implicit)
👍 1
b
Brian Dilley
07/29/2021, 10:57 PM
for simple accessors i use explicit, for more complex code i prefer implicit
n
Nir
07/29/2021, 11:06 PM
I don't know about swift but in Kotlin, implicit this is a bit of a way of life, it's a big part of what makes the dsls work
➕ 4
💯 5
y
Youssef Shoaib [MOD]
07/30/2021, 5:42 PM
To add to Nir's point, it is especially useful when you have multiple receivers in the same scope because you don't need a whole ugly