Core Data Structures Package(s)
Background
Mathematica is basically a data-structure free zone. This sucks. Using data structures efficiently makes code cleaner, faster, easier to maintain, and quicker to develop. They're great.
Idea
It'd be great if there were a package with some core data-structures built out and supported, either via LibraryLink
libraries or via high-level Mathematica coding, like I do for some of my packages. Ever since I moved to not using a bunch of List
and Association
args I was able to rapidly develop a bunch of new code off the data-structures I wrote because I didn't have to think about the nastiness of dealing with free-floating lists and ensuring good structure/behavior. It'd be fantastic to have lots of these that people could just drop into a package as a dependency.
Implementation Thoughts
I have this InterfaceObjects
paclet that makes it easy to create an object in the mold of like SparseArray
and friends. They're immutable, Association
-based creatures that are designed to not memory-leak, cause memory-bloat when reused, or to have unexpected unpacking or things like that.
The InterfaceObjects
package can be dropped into a BTools-style package as a dependency (I do this already for some of my stuff) and makes it pretty easy to rapidly make new objects as it handles much of the nastiness of type-checking, property management, methods, etc. I got at least four robust, highly-useful objects out of it in about one day of coding and I use them all over my packages.
I'm picturing this providing the basic object structure and then methods/properties being bolted onto this. In the cases where a LibraryLink
library may be used, this would basically mean the constructor to the InterfaceObject
creates a LibraryLink
object and allows the InterfaceObject
to hold this and provide methods on top of that. Where that's not possible, methods on the internal stored data (like a PackedArray
) can be used to allow for methods and manipulation to easily be implemented in an efficient, modular way.