···187187188188</details>
189189190190+### Prefer returning subpaths over components
191191+[subpath-preference]: #prefer-returning-subpaths-over-components
192192+193193+Observing: Functions could return subpaths or lists of path component strings.
194194+195195+Considering: Subpaths are used as inputs for some functions. Using them for outputs, too, makes the library more consistent and composable.
196196+197197+Decision: Subpaths should be preferred over list of path component strings.
198198+199199+<details>
200200+<summary>Arguments</summary>
201201+202202+- (+) It is consistent with functions accepting subpaths, making the library more composable
203203+- (-) It is less efficient when the components are needed, because after creating the normalised subpath string, it will have to be parsed into components again
204204+ - (+) If necessary, we can still make it faster by adding builtins to Nix
205205+ - (+) Alternatively if necessary, versions of these functions that return components could later still be introduced.
206206+- (+) It makes the path library simpler because there's only two types (paths and subpaths). Only `lib.path.subpath.components` can be used to get a list of components.
207207+ And once we have a list of component strings, `lib.lists` and `lib.strings` can be used to operate on them.
208208+ For completeness, `lib.path.subpath.join` allows converting the list of components back to a subpath.
209209+</details>
210210+190211## Other implementations and references
191212192213- [Rust](https://doc.rust-lang.org/std/path/struct.Path.html)