Skip to content

Commit 7aff487

Browse files
committed
.
1 parent a943cc5 commit 7aff487

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

content/unpack.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,18 @@ the user has to write code matching the internal implementation details and code
182182
relationships of the `def download` methods to construct the corresponding `case class` tree,
183183
even though they may really only care about calling a single `downloadAsync` method.
184184

185-
There are other more sophisticated ways that a library author can try to mitigate this -
186-
e.g. builder patterns - but the fundamental problem is unsolvable today. `unpack`/`*` solves
187-
this neatly, allowing the library author to use `unpack` in their definition-site parameter lists
188-
to share parameters between definitions, and the library user can either pass parameters
189-
individually or unpack a configuration object via `*`, resulting in both the definition site
190-
and the call site being boilerplate-free even in the more involved example below:
185+
There are other more sophisticated ways that a library author can try to mitigate this,
186+
e.g. builder patterns. But fundamentally the problem is that language feature has limitations
187+
that make people reach for user-land patterns as an alternative, at a cost of clarity and
188+
indirection. As a _library_ designer that makes sense as the least-bad option given the
189+
constraints, but as a _language_ designer we should strive to just fix the broken language
190+
feature so library designers don't need to jump through these hoops.
191+
192+
`unpack`/`*` solves this neatly, allowing the library author to use `unpack` in their
193+
definition-site parameter lists to share parameters between definitions, and the library
194+
user can either pass parameters individually or unpack a configuration object via `*`,
195+
resulting in both the definition site and the call site being boilerplate-free even in
196+
the more involved example below:
191197

192198
```scala
193199
case class RequestConfig(url: String,

0 commit comments

Comments
 (0)