Named parameters [was: Re: Reader mail bag]
Stephen Colebourne
scolebourne at joda.org
Thu Dec 7 11:52:08 UTC 2017
On 6 December 2017 at 19:46, Kevin Bourrillion <kevinb at google.com> wrote:
> Google's codebase is about 743% made up of Builders*, and our interest in a
> named/optional parameters feature is directly proportional to how many of
> these builders we think it could eliminate. :-)
>
> *figure may be exaggerated slightly
Yes, and OpenGamma Strata has many uses of multi-line builders, just
begging to be named parameters. Although to be fair, there are cases
where the power of a builder as a class can be useful (eg. use of
varargs to setup a list).
Named parameters wrt records is linked back to the nullability problem
however. If you allow nulls or optional fields in records, then you
need to provide a mechanism to create instances without specifying the
null/optional parts. Named parameters is one (good) way to do that.
However, right now there is no plan to handle null/optional properly
in records, so discussion of named params seems premature.
Stephen
More information about the amber-spec-observers
mailing list