R
Roedy Green
I created a macro called Path for the HTMLMacros system that displays
a fully qualified file or directory name with pretty CSS classes.
I use the convention that directories end in \ or / and files do not.
The program used many techniques to check if the entry was indeed
correctly coded, including asking the OS for files that actually
exist.
It complained about hundreds of miscoded entries. Most were simply
missing the final \ or ones like cacerts missing the trailing dot. I
had generated the macro calls using regexes to extract names, so they
not originally so coded.
I spent hours and hours making corrections. Then it suddenly dawned on
me, if my program can DETECT the errors, surely it can CORRECT them.
I had it emit CSV records of the form
as-it-is-now, as-it-should-be, in-which-file
I then manually pruned and enhanced these records to clean up other
junk, then fed them to the CSVReplaceStrings Utility.
BANG! the work was done!
I just wish I had thought of this earlier.
I wish an IDE could similarly be cleverer, and not just TELL you about
errors, but FIX them.
1. repair spelling errors, especially errors in case.
2. balance () and {} where the insertion point is obvious.
3. insert missing outer ( ) in if and switch
4. change the scope of something up or down.
5. insert/remove static
6. fix _for_ back to canonical form: for ( int i=0; i<n; i++ ) if the
syntax is broken in any way (e.g. missing ; extra ; missing int)
7. for bad exception, ask if you want to catch it or pass it on,
and insert the corresponding code.
8. put () around arithmetic expressions in concatenation chains.
Obviously it will do stupid things from time to time. It should make
you ok each fix, or highlight them for later review. You should also
be able to undo fixes.
Such an IDE would be a great boon to newbies who are often baffled by
error messages. It a waste of valuable expert time correcting this
trivia. see http://mindprod.com/jgloss/compileerrormessages.html
a fully qualified file or directory name with pretty CSS classes.
I use the convention that directories end in \ or / and files do not.
The program used many techniques to check if the entry was indeed
correctly coded, including asking the OS for files that actually
exist.
It complained about hundreds of miscoded entries. Most were simply
missing the final \ or ones like cacerts missing the trailing dot. I
had generated the macro calls using regexes to extract names, so they
not originally so coded.
I spent hours and hours making corrections. Then it suddenly dawned on
me, if my program can DETECT the errors, surely it can CORRECT them.
I had it emit CSV records of the form
as-it-is-now, as-it-should-be, in-which-file
I then manually pruned and enhanced these records to clean up other
junk, then fed them to the CSVReplaceStrings Utility.
BANG! the work was done!
I just wish I had thought of this earlier.
I wish an IDE could similarly be cleverer, and not just TELL you about
errors, but FIX them.
1. repair spelling errors, especially errors in case.
2. balance () and {} where the insertion point is obvious.
3. insert missing outer ( ) in if and switch
4. change the scope of something up or down.
5. insert/remove static
6. fix _for_ back to canonical form: for ( int i=0; i<n; i++ ) if the
syntax is broken in any way (e.g. missing ; extra ; missing int)
7. for bad exception, ask if you want to catch it or pass it on,
and insert the corresponding code.
8. put () around arithmetic expressions in concatenation chains.
Obviously it will do stupid things from time to time. It should make
you ok each fix, or highlight them for later review. You should also
be able to undo fixes.
Such an IDE would be a great boon to newbies who are often baffled by
error messages. It a waste of valuable expert time correcting this
trivia. see http://mindprod.com/jgloss/compileerrormessages.html