Open cometkim opened 1 year ago
This could fit nicely with a data structure library to go alongside Core. While Core is for basic JS functionality, this other library, let's call it Data for this dicsussion, would be specifically for data structures. It would include the data structure part of Belt, and vectors would fit very well in it.
Later on, one could consider deeper integration with the language. Curious about the pattern matching on the last element, and how common it is going to be. Got some nice examples?
@zth thoughts?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
i guess this could still be nice
More than ever. As we're sunseting OCaml std and Belt, we need a high-quality DS library
I guess having it as a separate installable package makes sense though, right?
Yes. I believe we already discussed somrwhete making the@rescript/data
package
Can it somehow also extend existing Core modules? There are a lot of convenience functions in Belt that I'd miss like Array.partition.
I think it depends on the goal of the Core.
If it prefers thin, mostly zero-cost bindings, I'd like to split the layer rather than directly replace Belt (like Jane Street's Core and Base).
Suggesting integrating @namenu's persistent vector library with the compiler.
https://github.com/reason-seoul/rescript-collection/tree/main/packages/vector
This library implemented in pure ReScript is optimized for changing the last element, unlike a list optimized for changing the head (first element).
This is useful if a user needs an Array-like structure but an immutable one. It is faster than the ImmutableJS and Mori, which are homogeneous libraries available in JS. (See benchmark)And its stability has been verified with fuzz tests.
It is available today in any ReScript project, but integrating it with a compiler can provide list-like ergonomics. For example: