SID # 1 - Named and Default Arguments

Scala Improvement Document # 1
Revision: 7 - Date: 2010-01-22
Status: 
active
SID: 
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.

Document: 
4.6
Average: 4.6 (35 votes)
Your rating: None

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