According to this answer https://stackoverflow.com/a/8001065/1586965 we can do this in Scala:
val _ = 5
Now I understand the point of ignored parameters in lambda expressions, but I cannot really imagine examples where I would ever want to declare a variable that by definition I cannot reference. The only example I can think of is being lazy about naming implicit values, e.g.
implicit val _: MyNumeric = ...
...
class A[T : MyNumeric] {
...
Is this the only use case? Am I missing something?
If it is the only use case, shouldn't the compiler/IDE give a warning/hint when the val
is not implicit as it is utterly pointless?
Clarification
By variable/value I mean a single one, not one that is part of an extraction declaration.