This page is no longer maintained — Please continue to the home page at

SID # 1 - Named and Default Arguments

Scala Improvement Document # 1
Revision: 7 - Date: 2010-01-22
Named and Default Arguments

Named and default arguments were added to Scala in version 2.8.

Named arguments improve the readability of method calls with many arguments, and they can avoid traps when a method has many parameters of the same type.

Default arguments are a nice feature to reduce code duplication (e.g. ad-hoc polymorphism aka overloading) and they enable the implementation of a "copy" method for case classes. This method can be used to quickly generate modified copies of instances of a case class.

Average: 4.5 (40 votes)
Your rating: None

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland