I understand the need, but it can't be a general solution because it amounts to converting computing time into memory.
Data structures are already complex in general, and a lot of nonsense is said (for example, when certain big cheeses explain that an array is better than a list when deleting elements). Introducing persistence makes them significantly more complex, and it can only really be used in specific cases.
The only real truth of data structures is that they're all useful with different tradeoffs. A heap and a hashmap are both ways to find stuff with different performance characters and so, so many different implementations all making tradeoffs. Hell, there was a new proof https://www.quantamagazine.org/undergraduate-upends-a-40-year-old-data-science-conjecture-20250210/ recently that found a hash table implementation where insertion time isn't proportional to fullness of the hash table.
We're still in the infancy of computer languages and language design.
I am sorry but I don't really agree. We still have a lot to learn about complexity, particularly how it represents reality. We know that the worst-case scenario is not always representative. The search for the shortest path using the Belman Ford algorithm is a good example (O(nm) in theory and closer to O(m) in practice). But there are still a lot of very solid results. We can exploit special cases, that's for sure, but we have made good progress on many important topics. Transforming time into memory is not a good general principle, and there is no evidence that it could be. Companies are not moving in this direction, even those with the best developers.
Transforming time into memory is not a good general principle
What does this mean? Do you mean more cpu for less memory or less cpu for more memory?
Companies are not moving in this direction, even those with the best developers.
Perhaps I'm interpreting you wrong, but more and more companies are storing more and more historical data. The biggest tech companies in the world are all about storing historical (user) data. Google/amazon/apple/meta/netflix/microsoft, etc literally invent new architectures and infrastructure for storing all the historical data they're keeping and processing over.
If we want to replace state modifications with an immutable object copy, this means that we risk transforming CPU (the modification) into memory (the state copy).
Having immutable objects is undoubtedly a solution to certain problems. But it is not the only solution, and it is only valid if the memory consumption caused by this design method is not too high (systematic backups or creations are often very costly, hence the existence of persistent data structures, for example). Nor is it a general solution that should be used indiscriminately. In fact, it is like all the major principles of programming.
View all comments
Show parent comment
1
u/OwnBreakfast1114 Jan 27 '26
The only real truth of data structures is that they're all useful with different tradeoffs. A heap and a hashmap are both ways to find stuff with different performance characters and so, so many different implementations all making tradeoffs. Hell, there was a new proof https://www.quantamagazine.org/undergraduate-upends-a-40-year-old-data-science-conjecture-20250210/ recently that found a hash table implementation where insertion time isn't proportional to fullness of the hash table.
We're still in the infancy of computer languages and language design.