Is it Time for Metadata in Source Code?

It suddenly struck me how that programmers are deprived of metadata, compared to other computer users. Word processor users have tons of data about their documents, size, layout, fonts, colors, and it all travels with the document. Likewise Photoshop users have loads of metadata about the layers and objects and other stuff that makes up their image.

But what do programmers have? Nothing! Just plain text files. If you’re working in a command line environment, it’s nothing but text files, source files, make files, lists and include files. In an IDE it’s a little better, but the metadata is stored (probably in XML) in a proprietary format associated with a project or workspace.

I think it’s time for that to change. I think we need to find some way to mark-up source code so that it is more useful than just fodder for the compiler. Maybe layout  tags that tell the editor to display the source with your personal style of bracing and indentation. Maybe meta-tags for syntactic sugar that formats it the way you prefer. For instance, in Objective-C [foo setBar:bar] and = bar; are the same thing. The second example, the dot syntax is a newer addition to the library. Some people don’t like the new syntax, so what if their IDE somehow knew this and converted the code? It’s all the same to the compiler, after all. But converted it in such a way that someone who preferred the dot syntax would still see the dot syntax and be able to write the dot syntax.

There’s many other things that meta data could do, like preserving revision information in the file, instead of in the VCS. Isn’t that what word processors do?

Maybe there’s a way to include the programmer’s documentation in the source, in a more useful way than just comments. Comments rapidly lose their meaning, and even location, as code changes. Maybe metadata could be attached to variables and functions, and travel with them, even with moving to other files where the functions are called.

I’m sure there’s a lot of other uses, and I’m sure there must be ways to implement these features in a standard way to work with any language, and any toolset.

I’m asking for feedback on this. What do you think? Is this the way of the future, or just needless complexity? How do you think it could work? What other features can you envision? Let me know!