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

python - Does anyone know how to configure the hunpos wrapper class on nltk? -

mysql - How to insert just year and month into date field? -