1. Start Here
    1. Introduction
  2. Guidelines
    1. White Space
    2. Indentation
    3. Line Wrapping
    4. Methods & Side Effects
    5. Code Blocks
    6. Anonymous Code Blocks
    7. Dots versus Spaces
    8. Files
  3. Reference
    1. Scala
    2. Bizo
    3. Official Scala Style Guide
  4. Google Custom Search

Anonymous Code Blocks [Edit]

  1. Use parenthesis for pure anonymous functions with placeholder syntax (underscore)
  2. Use braces for side-effecting anonymous functions with placeholder syntax (underscore)
  3. Use braces and new indented code block for longer anonymous functions

Use parenthesis for pure anonymous functions with placeholder syntax (underscore)

  // preferred
  val cubes = _localCubes.values flatMap (_.values)
  // hmmm-kay
  val cubes = _localCubes.values flatMap { _.values }

Use braces for side-effecting anonymous functions with placeholder syntax (underscore)

  // good
  nodes.valuesIterator foreach { _.delete() }

This produces clearer grouping and delimiter-balance than consecutive parenthesis.

  // wrong
  nodes.valuesIterator foreach (_.delete())

Use braces and new indented code block for longer anonymous functions

  // right
  val remotePartitions = latest.partitions map { p =>
    val partition = Json.parse(p.partition)
    val pv = new PartitionVersion(new Partition(dims, partition), p.version)
    new RemotePartition(cube.database, cube.cube, pv, path(cubeURL, pv.partitionPath))
  }