One thing has long bugged me about coding with other people (which is simply a reality for the vast majority of folks these days) … all the holy wars over brace style, tabs versus spaces, trailing whitespace being a no-no, line length … ad nauseam. I think I have an idea that will allow us to do away with this in one fell swoop …
The format in which I view and edit my code does not have to be a direct one-to-one representation of the code that gets stored on disk. For example, I might enter:
def foo( a , b , c=1 )
bar a, b, c
end
And what might get stored on disk is:
def foo(a, b, c = 1)
bar(a, b, c)
end
Obviously, the editor would need to do a bit more work and would probably need a full parser for any language it would provide this feature to. But wouldn’t it be worth it to finally be able to stop arguing about these debates that have raged on for decades?
I would expect to have to define the following:
- The display style (tab width, brace style, etc etc … it would vary highly depending on the language)
- The storage style
The display style would probably be the same across all projects while the storage style would be project-specific. But this way, all my code could look the way I want it to … and I wouldn’t be putting anyone off because on their machine it would look just the way they want it to. And if we built enough smarts into it, the formatting engine could minimize the impact of edits to make diffs clearer besides!
This would also make the whole maximum line length debate go away (about time!) because the editor could be smart enough about the language being edited to wrap it on a small screen even if the line was far too long to fit For example:
puts "Wow this is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, long line of text!"
Could be rewritten for display into:
puts "Wow this is a really, really, really, really, really, really, " \
"really, really, really, really, really, really, really, really, " \
"really, really, really, long line of text!"
Thoughts? Crazy? Or crazy enough it just might work?!?