Do you use them? If yes, how often? Share your experience with them please.
This is related to an open issue, and is my own attempt to gather community responses to help the maintainers gauge the interest in those modules, at least at a limited empirical scale.
For the record, I rely on them only on certain functions, blit
is a classic use-case, and also when it makes sense to have data first then a large trailing function on the likes of map
and filter
, as in Data.map data ~f:(fun ...)
, with the alternative sometimes being data |> Data.map (fun ...)
, or just have the data way down at the tail end, or give the lambda a name, which are all less appealing IMO…
What’s your experience with standard labelled modules?
bonus section for those who want to see more labels
There is a problem with having to mirror files (once with labels and once without) to produce the current state of affairs, not only for the maintenance burden in syncing up the modules, but also because it’d bloat up the distribution and I imagine that bloating alone annoyed enough end-users for it to motivate maintainers to explore compression among–other–things.
Additionally, labels complicate partial-application and interact with polymorphism in surprising ways (try to misspell a label!), and they just add too much verbosity sometimes… There are true and tangible reasons to reject a labels take-over in standard APIs for many OCaml users including myself. And in that sense, label-heavy APIs like base/core feel a bit too much and a lot too much to make mandatory in stdlib (not that I think it’ll ever happen with stdlib’s strong backwards compat guarantees).
Now, in trying to think up a way to relieve this situation, the first question that popped up in my head was “why not unify?”, and I don’t mean this in a user-facing way, I mean it in a toolchain way. It’d be a lot less work in the long term to maintain only the labelled versions, at the cost of having to answer now the difficult question of how to do that but keep them optional in a user-facing way. Perhaps give the compiler the facility to discard labels completely (not just ignore them with -nolabels
)…? Perhaps as an annotation on module aliases/definitions/inclusions or as a flag that’s passed in the commandline…? Perhaps with the aforementioned default inverted (i.e. annotate to get labels)…?
The immediate problem I see with my ideas is that now labels become a take-it-or-leave-it deal, and we have labels in plain stdlib (e.g. String.starts_with
)… I don’t know if either “it’s ok because they’re still in stdlabels” or “let’s come up with a way to override the unlabel annotation/flag”, is a satisfactory answer to that, really.
This is an invitation to brainstorm this problem, for those interested, on top of answering the main questions above.