Scala Object
Jump to navigation
Jump to search
A Scala Object is a software object that is a Scala data structure.
- Context:
- It can be subject to Garbage Collection when it becomes unreferenced by the rest of the Scala process.
- It can range from being a Scala Mutable Object to being a Scala Immutable Object.
- Example(s):
- a Scala Monad.
- a Scala HashMap.
- …
- Counter-Example(s):
- See: Scala Class.
References
2013
- (2013, Melli)
trait Versioned {
def version : Int
def nextVersion = version + 1
}
case class Customer(name: String, version : Int = 0) extends Versioned {
def withName(newName: String) = copy(name = newName, version = nextVersion)
}