actually pretty simple

code editor feature:

In programming, {braces}, [brackets], (parentheses), "quotes", etc., are always only created and destroyed in pairs.

In the same way that a word processor would not create a <b> tag without creating a matching </b> tag, a code editor should not allow blocks to be unbalanced.  So, in the same way that you make text bold by pressing ctrl-B, you should make code into a block by typing {.  And when you delete one bracket, it's the same as deleting them both, because it doesn't make sense to have one without the other.

Making the editor smart enough to do this correctly when you don't have anything selected is a bit of a trick, but I think it should be solvable.

So, perhaps my short term personal goal shall be to download scintilla and SciTE source code, and to see if I can hack it up to act this way.  Eventually the goal is to take the job of managing blocks and whitespace away from the programmer entirely.*

*Currently there are lots of editors that will tell you, "hey, your blocks are unbalanced here", but I think that's lazy and insufficient.  Software tools should never be lazy, they should let their users be lazy.  Whenever a program tells me that I have a problem and how I should fix it, I look for the button on the dialog that reads "fix it yourself if you're so smart."  I never find it.

No comments:

Post a Comment