– |
List(1, 2, 3)
Array(12.3, 45.6)
Set("a", "b", "c")
|
- primary way of construction
- resulting instance contains provided arguments verbatim
|
of |
Person.of(name, age) |
- secondary way of construction
- resulting instance contains provided arguments verbatim
- result type might use
Option or Result types to encode failures
|
from |
Person.from(personEntity)
Person.from(family)
|
- tertiary way of construction
- arguments are extracted, adapted, and/or converted
- the value of the instance is derived from the provided arguments
- result type is likely to use
Option or Result types to encode failures
|
parse |
Person.parse(string)
Int64.parse(string)
|
- quaternary way of construction
- argument is parsed from a less structured representation, such as strings
- result type is highly likely to use
Option or Result types to encode failures
|
with |
person.withAge(23)
person.with(age = 23)
|
- returns a copy of a value with parts replaced by the provided argument
|