Replies: 5 comments 5 replies
-
Taking this from what I once wrote elsewhere. My take on this would be:
This means providing datatypes and essential functions so that when you try to build an application with the bazaar, you don’t end with two different concurrency monads, three different modules of string convenience functions and four incompatible definitions of file descriptors. This is not to say that the line is easy to draw but it should allow to guide some decisions. For example rather than the language or stdlib enshrining and providing support for the serialization format du moment, it’s likely a better idea for the stdlib to provide infrastructure for the serialization problem. |
Beta Was this translation helpful? Give feedback.
-
Personally my usual comment regarding extending the scope of the stdlib quite a bit is that there are few benefits compared to using a third-party package. I have the impression that, for the OCaml community, having specialized packages to do this or that tends to work better than having large, integrated libraries that try to cover a lot of ground. The main effort in the direction of "let's cover a lot of ground" I was involved in was Batteries, and it suffered a lot from its own weight. I could see ourselves doing more in terms of data-exchange formats for interoperability purposes, and I remain supportive of efforts to make FFI-types more standard (yes, unsigned integers). But getting a HTTP client library in the stdlib sounds like too much of a commitment for no clear gain compared to having it developed and maintained outside. On the other hand, we actually have a decent track record of exploring state-of-the-art options for PRNG, compression lately, and hashing, thanks to @xavierleroy's interest in this corner of the algorithm toolbox. One thing that works well for the stdlib is that we can expose these capabilities without being too explicit about which specific algorithm we chose, and so we can evolve in the future in a mostly backward-compatible way. In summary: I would personally push back on growing the scope of the stdlib in very different problem domain, and rather try to foster a vibrant ecosystem of third-party packages to cover those needs. I think there is room for new modules that are small and require little maintenance, typically simple, common data structures (I am working on dynamic arrays, we mentioned priority queues, maybe there are other ideas but no need to hurry). I could see us adding some transversal aspects to many modules (for example a non-trusted serialization / data exchange format). Maybe some concurrency-related structures as well? |
Beta Was this translation helpful? Give feedback.
-
That sounds a lot like containers ;-).
Joke aside, the stdlib already has AVL trees in Map and Set. Heaps are
a big missing feature, idk why.
Graph algorithms are harder to do satisfactorily without more
abstraction, which is why most people use ocamlgraph and its functors
that can work with one's own data structure. I personally almost never
have "a graph", I always have something that can also behave like a
graph.
…--
Simon Cruanes
|
Beta Was this translation helpful? Give feedback.
-
On Mon, 27 Mar 2023, L1-42 wrote:
I don't think Containers has a binary tree nor a graph module...
https://c-cube.github.io/ocaml-containers/dev/containers-data/CCGraph/index.html :-)
As far as binary trees are concerned, I don't know what interesting
operations you can provide on them. I've never used "just" a binary
tree, and it's just simpler to define your own?
As for graphs, I am not familiar with ocamlgraph at all, but it still seems like only a few algorithms are implemented... A*, Kosaraju's algorithm, Prim and Kruskal algorithms, etc. are still missing... (Although having those algorithms would definitely be better in a Containers style library)
Tbh that sounds like a graph library, not a standard library :-). Who
needs all that in most of their projects? They would make good
contributions to ocamlgraph I suppose.
…--
Simon Cruanes
|
Beta Was this translation helpful? Give feedback.
-
At the risk of being "that person" in the discussion, I'd like to say that the word standard in the phrase "standard library" is where the trouble begins. In my view, a standard is something promulgated by something with the power to mount a campaign. In the realm of technology, that usually means some kind of standards body or an organization that can function like one. Otherwise, what you have is not really a standard, but rather at best a convention, a best current practice, or perhaps merely a popular alternative. The OCaml "standard" library is not really the standard, so much as it is the general purpose library distributed with the compiler, which is among several alternatives competing for recognition as a standard. The organization that might be in the best position to facilitate the promulgation of a proper standard is OCaml Software Foundation, but as near as I can tell from reading its web site, that's not in its charter. Perhaps that should be up for reconsideration? |
Beta Was this translation helpful? Give feedback.
-
This question (having a lean standard library vs a "batteries-included" one) has and continues to come up frequently whenever new additions to the standard library are considered. Not having a clear (and consensual) answer to this question amounts to a lack of strategic direction for the standard library, and it greatly hampers its evolution.
Recently the question came up again in the context of #11098.
@gasche opined:
And @c-cube followed up with:
I think this question is important. Answering it is a prerequisite to figuring out what is the "basic stuff" that @gasche alludes to in his comment.
Should the standard library remain, like it is currently, a quite minimalistic algorithmic package with an approximately POSIX-equivalent layer of IO capabilities? Or, should it provide a set of features that will be useful in most programs (which, in this day and age, I'd argue must include json, base64, better IOs, crypto hashes, and lots of other network related basics)?
Beta Was this translation helpful? Give feedback.
All reactions