Syntactic sugar for spreading a tuple when passed into a function


Is it possible in scala to have a syntactic sugar for spreading a tuple when it is passed in to a function/method


def getname(id: Long): (String, String) = {}
def hello(fname: String, lname: String): Unit = {}

Note: I know we have a tupled method, but that can be hidden away right


desugarings are currently done in the parser, where no type information is available, so with the current kind of desugarings: no.


I don’t see why it wouldn’t work when interpreted in a less literal sense. We already do some tuple adaptations in typer but they are only apply to specific syntactic elements (e.g. deciding if foo(1, 2) passes two arguments or one tuple; deciding if { case (x, y) => () } is a Function2[?, ?, Unit] or a PartialFunction[?, Unit]). The adaptation in question here could be implemented in the same way. The fact that it is more general and purely type-driven makes it harder to integrate into the language though. You’d have to figure out how to integrate it with implicit search, overload resolution, etc. And, of course, you’d have to justify the additional complexity, both conceptually and in compilation time (from having a larger search space for adapting method arguments).