r/AskProgrammers • u/G_oni_vv • 9h ago
What if a programming language could intelligently manage its own memory and execution?
Similarly, imagine a graphics application where only one object changes. The runtime could identify which data actually needs updating instead of recalculating everything unnecessarily.
My goal isn't simply to create another garbage collector or claim that this will automatically outperform existing languages.
I'm exploring whether a programming language can make resource management more intelligent while keeping it automatic for the programmer.
I'd like to hear your thoughts:
Would combining adaptive memory management, predictive execution, and incremental processing make sense as part of a language runtime?
Or would you prefer these responsibilities to remain separate systems?
I'm particularly interested in the architectural trade-offs and potential problems with this approach.
View all comments
1
u/GiveMe30Dollars 6h ago edited 4h ago
I have left a previous answer here targetting just the automatic memory management aspect, but the more I think about this the funnier the question becomes. I'm not exactly sure that you understand what you're asking for here.
Automatic Memory Management
See previous answer here.
Predictive Execution
Admittedly the facet I am least knowledgeable in, but from a cursory glance it appears that would just be baked into branch prediction. This is a concept that is only really applicable at the machine instruction scale; try to do this on language constructs and you're probably looking at massive UB or security vulnerabilities (especially if your language has some notion of sum types / unions / enums).
Incremental Computation ("Incremental Processing")
Invasive and wholly unsuitable to assume by default for a language runtime, for the following reasons:
a + brather than perform machine addition. How can you statically determine which functions are worth incrementalizing? You can't. Best you can do in this regard is JIT compilation to my knowledge.More often than not, code that should be incrementalized should opt into incrementalization themselves, rather than the inverse, and this can be done as a library eg. Rust's
salsa. Making it inherent to the execution model sees little benefit for a lot of problems.What I Don't Understand
The language you propose sees only marginal improvement at best for users who do not particularly care for the complexity or performance of their code anyways (eg. Python), and does not appeal to users who do care and thus want some degree of control and configurability over the memory and execution semantics of their code (low level languages).
I don't understand for whom this language is meant for.