Scala: function/method application and tuples -


i stumbled across pretty interesting behavior in scala.

scala> def foo(t: (int, int, int)): int = t._1  foo: (t: (int, int, int))int  scala> foo(1,2,3) res23: int = 1  scala> foo((1,2,3)) res24: int = 1 

this works other way round:

scala> some(1,2,3,4,5)      res31: some[(int, int, int, int, int)] = some((1,2,3,4,5)) 

while sugar extremely useful did not find documentation concerning this. question basically: documented in scala language specification, , other implications have if any.

regards, raichoo

it known automatic tupling. lodged bug against language specification, silent on matter.

here's relevant part of compiler source code.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -