Source code stored in object structures
Juten Tach,
there is a topic i’ve been thinking about lately, which is source code and the way we store it currently. Specifically, i do wonder, if storing source code as text is still the right way. Especially for languages, which are not run in an interpreted way, but compiled or pre-compiled i wonder, why we actually store that code in text files.
If you look at all the tools we use, the IDEs, the compilers, UML modelling applications. All these tools currently take textual code and transform it into intermediate object structures, with which they work. Take code highlighting. For being able to have proper code highlighting, tools have to parse the text, understand the very basics of the structure of the code in order to do the highlighting.
Take code completion. The tool has to parse the textual source code into some kind of object structure in order to understand, what references, functions or objects to offer.
Take refactoring. The tool has to parse the textual source code into an object structure in order to change namings, move functions into different classes while updating the references and organizing imports and so on.
Take UML reverse engineering. The tool has to parse the textual source code into an object structure in order to build the represented class hierarchy that serves as the basis for visualizing that hierarchy in UML. All these tools work with object structures or syntax trees rather than with the text itself. Alle these tools have to parse the text over and over again.
In the end, that’s also, what the compiler does before it transforms the whole thing into binary instructions. So, i ask myself, wouldn’t it be more efficient to actually store the source code in some kind of object structure, so that these tools can make direct use of it instead of having to parse it again and again?
Googling this subject (i was not even sure, what to search for, because i couldn’t decide on good search terms), i only found one wiki article, that discussed that topic a little bit, but differently, as that the people there thought about storing source code in databases, which i am not so sure, whether this is the best way. But the thoughts behind that go into the same direction.
I understand, that storing source code in text files has some significant advantages, the most obvious being, that everyone can read text files, because it is so standard and minimal. Also, source code repositories make use of text and can handle it very intelligently.
But i think, since software applications today become more and more complex, wouldn’t development environments, that handle source code as object structures from the very start, be capable of handling that source code more efficiently and even more intelligently? If we would start thinking about source code as being a model and a textual representation of that model simply being one view (UML being another), wouldn’t that provide completely new possibilities for IDEs and the whole ecosystem of software development? In respect to MVC, doesn’t source code stored in text files currently strongly couple the model with the view, something we normally try to avoid as hard as we can? Things like indentation, the use of braces or brackets, specials keywords, semicolons and blank lines, aren’t these just visual decorations, either in order for us to be able to read the code or for the parser to parse it? Imagine, how code could look like, if we wouldn’t need those things, because we wouldn’t need a text parser.
Have you found articles on that topic? Would be curious to see them.

Guten Tag as well,
have a look at
Intentional programming
thats somehow the direction you’re pointing to.
aside from Self there is another more current programming language that uses this feature, or better: is built upon this concept.
but i just can’t remember which language it was – i’ll have to browse my bookmarks and come back to you.
Cheers,
Ben