4 ms·
A nice solution was used during development of the Go language: a tool for code rewriting (it was called "go fix"). It allowed the language authors to quickly a
by akavel 11y ago
A nice solution was used during development of the Go language: a tool for code rewriting (it was called "go fix"). It allowed the language authors to quickly and easily transform large swaths of code in the standard library, and also let everybody execute the same transformations in any third-party code. Thus enabling rapid and extremely painless iterations. [I'm consciously simplifying the story a bit to make it shorter and more concise, but I'm not hurting the core message I believe.]
- breuleux 11y agoI think that's a neat idea. I've thought about it, but I've never used Go personally and I wasn't sure just how much it would help. I imagine it works best for languages with good static properties/tools for code analysis.
- lmm 11y agoI think the important cases are the ones that you can't fix by hand - the ones where you're removing a dangerous idiom.
- joliv 11y agoYeah, Python tried this as well with their 2to3 tool (https://docs.python.org/3.5/library/2to3.html https://docs.python.org/3.5/library/2to3.html), but their release bump was a little bigger than the Go prerelease changes (and the users not as flexible) so it wasn't much of a magic bullet.
- kevin_thibedeau 11y agoI find it very useful but it does help to write forward compatible 2.x code and test frequently with 2to3 to catch what it misses.
- stepanhruda 11y agoXcode/llvm has this with fixits.
- merb 11y agogo fix didn't worked all the time. there were some edge cases where it failed. also syntax of go didn't changed much.