scala - Why should I use object vs trait Dependencies and import it vs mixin to build definition? -
scala - Why should I use object vs trait Dependencies and import it vs mixin to build definition? -
i've been noticing people using pattern object dependencies
, doing import dependencies._
in object build
in sbt follows:
import sbt._ import keys._ object dependencies { // dependencies declared vars } object build extends build { // bring dependencies' vars scope import dependencies._ // project definitions }
quite found approach trait follows:
import sbt._ import keys._ trait dependencies { // dependencies declared vars } // bring dependencies' vars scope object build extends build dependencies { // project definitions }
i think trait approach gives me improve naming build object since reads object build build dependencies inlined.
what differences between approaches (besides perhaps improve writing/reading of object)?
i think question might boil downwards differences between objects , traits in scala, since it's narrowed sbt build definitions (that think doesn't need much expressiveness) thought i'd inquire here build definition mutual patterns.
there's no semantic difference between two. if have pick one, i'd prefer object dependencies
variant because 1 works improve build.sbt
files.
scala sbt
Comments
Post a Comment