In Scala I can use underscore as a type variable in function, for instance.
def fun[_, _]() = {
// ?
}
fun[Int, String]()
Is it so useful in real life programming? How could it be useful for me?
Is it so useful in real life programming?
No, it isn't.
How could it be useful for me?
To confuse people. You could theoretically use it to mark an unused type parameter when e.g. overriding a method, but I don't think I've ever seen this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With