Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion style/declarations.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -188,7 +188,7 @@ There are three main reasons you should do this:
type inferencer can allow a simpler syntax when invoking the
remaining parameter lists. Consider fold:

def foldLeft[B](z:B)(op: (A,B) => B):B
def foldLeft[B](z:B)(op: (A,B) => B):B
List("").foldLeft(0)(_ + _.length)

// If, instead:
Expand Down
14 changes: 7 additions & 7 deletions style/naming-conventions.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,7 +36,7 @@ development.:
}

object inc{
def apply(x: Int): Int = x + 1
def apply(x: Int): Int = x + 1
}

In *all* other cases, objects should be named according to the class
Expand DownExpand Up@@ -270,22 +270,22 @@ all-uppercase style):

// Right
class Map[Key,Value]{
def get(key:Key):Value
def put(key:Key,value:Value):Unit
def get(key:Key):Value
def put(key:Key,value:Value):Unit
}

// Wrong; don't use all-caps
class Map[KEY,VALUE]{
def get(key:KEY):VALUE
def put(key:KEY,value:VALUE):Unit
def get(key:KEY):VALUE
def put(key:KEY,value:VALUE):Unit
}

If the scope of the type parameter is small enough, a mnemonic can be
used in place of a longer, descriptive name:

class Map[K,V]{
def get(key:K):V
def put(key:K,value:V):Unit
def get(key:K):V
def put(key:K,value:V):Unit
}

### Higher-Kinds and Parameterized Type parameters
Expand Down