-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
Description
lib
is a bit messy right now, where some functions are available in lib.*
, but some need to be accessed as lib.<sublibrary>.*
.
Traditionally all functions were available under lib.*
, but in recent years we've seen that it doesn't work that well. An example is how lib.hasPrefix
works on strings, it's aliased to lib.strings.hasPrefix
. But it also makes sense to have such functionality for lists and paths, we should be able to re-use the same name. This is now done:
But lib.hasPrefix
still needs to point to lib.strings.hasPrefix
for backwards compat, and this previously caused problems when accidentally using lib.hasPrefix
for paths:
Furthermore, lib
is tending towards the style more emphasised since
{ lib }:
let
inherit (lib.lists)
length;
inherit (lib.strings)
hasPrefix;
in
...
which makes sublibraries not much harder to use (no need to always use lists.length
).
We should establish a standard for sublibraries and make sure it's consistent.
Related issues/comments: