Make LaTeX a modern programming language
I'm not an expert on LaTeX like some of the people here, but I have many times run into LaTeX's limitations compared with modern programming languages (that I am very familiar with). I believe that in the long term, LaTeX should not be a macro language for exactly the reason that it is very hard to apply the straightforward programming concepts that other languages take for granted: abstraction, inheritance, polymorphism, dynamic programming, etc.
Memoization of section compilation
Why is the whole document recompiled every time? Why can't some of the work for each paragraph (or section or figure) be kept if the context (font, spacing, block width, etc.) in which the paragraph is recompiled does not change? LaTeX should memoize the result of compilation for each section based on the context in which it is compiled. This would eliminate the need for breaking your document into various tex files and recompiling them yourself (doing the job of the compiler), and it would supplant
Allow LaTeX “macros” to be programs that interact with the context in which they're invoked. I think there are problems with footnotes in captions, or footnotes in table notes. I don't remember, but I know I've run into them. My guess is that these problems would be mitigated by having both the context in which something is invoked (table, bibliography, figure caption) and the embedded element (footnote, another figure, etc.) be able to answer questions to each other to come to some conclusion about how to be rendered. I don't understand
\DeclareRobustCommand, but hopefully this would eliminate them.
Full programming abstractions
Many of my diagrams are coded in Python that generates Tikz code. Tikz looks great, but its programming features are severely limited compared to the freedom you have in Python. Even if you can do something, it is hard to read and hard to debug. Wouldn't it be great Tikz were a Python module?
So many errors can be avoided by ensuring that when a color is requested, it is in the right format xcolor,
#122314, and so on… Regular programming languages can verify the types of their arguments.
It would be much easier to write a debugger as Werner suggests if LaTeX were a regular programming language.
My suggestion would be to make a Python module that implements the various internal latex compilation routines.
This module would provide programmatic access to a “latex context object” and a “compiled latex element”. Inspecting these would let you see all of the relevant settings in relevant subobjects. This would be much more useful than any LaTeX debugger.
Early versions are still useful
You don't have to worry if you can't complete a whole latex replacement. Even the early versions of such a module would still be very useful. Just a module that provides pythonic access to Tikz would be extremely useful to me.
Python already has a great debugger.
Python already has the ability to transparently incorporate fast C++ versions of methods, and with development of pypy, regular python may one day be comparable in speed to hand-coded C++. Anyway, the benefit of cached compilation far outweighs faster compilation in my opinion.
LaTeX macros should be regular Python objects
Besides Python's excellent object model, it has amazing metaprogramming facilities. If you ever find yourself writing the same code twice, in Python, you don't have to. It can be very useful to write code that writes code.
I doubt that latex module development is not hampered by the fact that everything is a macro. Take a look, for example, at tikz.code.tex. Try to make sense of anything. This code looks like it was written 30 years ago. Software engineering has come a long way since then: encapsulation, abstraction,… separation of concerns. You don't realize the value of these things until your code is a couple thousand lines and you can't keep it all in your head. Imagine how much faster latex modules would be developed if it were a modern programming language.
Separation of syntax from compilation
All of this can be done without deciding what LaTeX code should look like. Someone can use the Python module to interpret existing LaTeX code, or design a new variant of LaTeX code. Other people can use the Python module directly within Python to generate figures or programmatically generate documents.