sbt - Scala build settings(foobar: _*) -


this question has answer here:

i see in spray build.scala

lazy val spraycaching = project("spray-caching", file("spray-caching"))     .dependson(sprayutil)     .settings(spraymodulesettings: _*)     .settings(librarydependencies ++=       provided(akkaactor) ++       compile(clhashmap) ++       test(specs2)     ) 

what .settings(spraymodulesettings: _*) do? spraymodulesettings: _*.

.settings method takes variable argument list. spraymodulesettings seq. : _* tell compiler want pass elements in spraymodulesettings arguments method.

scala> val s = seq(1,2,3,4) scala> def test(args:int*) { println(args.length) } scala> test(s) <console>:10: error: type mismatch;  found   : seq[int]  required: int               test(s)                ^  scala> test(s:_*) 4 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -