4 ms·
I made an automatic error fixer once in Powershell. When you load a module, it would catch missing commas between parameters, and update the module file with th
by stephengillie 9y ago
I made an automatic error fixer once in Powershell. When you load a module, it would catch missing commas between parameters, and update the module file with the missing commas. I want to extend it to catch many more common coding mistakes.
This sounds like the opposite idea, remove the function instead of repairing it. Very aggressive idea.
- aetherson 9y agoYou get that this language is a joke, right?
- abhirag 9y agoFrom the docs -- "Eternal moral vigilance is no laughing matter" :P
- alimw 9y agoAdopting this scheme might really lead to improved code quality.
- mnemonicsloth 9y agoWell yes. The empty program is 100% bug-free. I don't think any other language can guarantee that your code will be 100% bug-free.
- chris_wot 9y agoThe contract is to do something specific. If it doesn't do that then it's a bug. It will need to delete itself.
- braveo 9y agoI would be interested in the technique you used to do this. specifically, how did you get your code to kick off and check on module load?
- stephengillie 9y agoReplying to braveo's unfortunately dead comment[0]: > I would be interested in the technique you used to do this. specifically, how did you get your code to kick off and check on module load? Powershell has great error-handling, and all errors are stored in the special $Error variable. For missing commas, semicolons, brackets, and other punctuation, the errors usually have the line-and-column of the missing item. So the function would just parse $Error and update the module file with the right item at the right location. [0] https://news.ycombinator.com/item?id=15212428 https://news.ycombinator.com/item?id=15212428