<div dir="ltr">This is exactly what I suggested at Dconf, and this is what go has done with go fix:<div><a href="http://golang.org/cmd/fix/">http://golang.org/cmd/fix/</a><br></div><div>so it can definitely be done. After using that, user can just use git diff and see summary of changes if he wants. That is *the* path to improving D's API. Code with source can be changed, compiled code without source doesn't need to be changed. </div>
<div>The discussion should focus on how to help with harder cases involving string mixins found while executing CTFE. </div><div>Btw, refactoring code with AST macros should be easier than with string mixins.</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Nov 10, 2013 at 11:36 AM, Adam D. Ruppe <span dir="ltr"><<a href="mailto:destructionator@gmail.com" target="_blank">destructionator@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sunday, 10 November 2013 at 19:30:30 UTC, Michael wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
search/replace regexp ?)<br>
</blockquote>
<br>
I think the way I'd do it is combine that with the compiler. So you compile your code. The compiler generates an error. The fixup script checks the errors against the pattern it has and then does the necessary changes on  the file, then writes it back out (perhaps doing a backup and/or user confirmation, like replacing files on a copy: yes, no, yes to all, with yes to all just following that same pattern - if it is a different class of error message, or if the replace would replace two things when it should only be one, it asks for confirmation again)<br>

<br>
This actually shouldn't be too hard to write for quite a few things, and using actual errors would be more reliable than a plain find/replace.<br>
<br>
The interactive session can go pretty fast<br>
<br>
$ fixup<br>
error foo.d line 30 undefined identifier safe<br>
   @safe void foo() {<br>
replace with<br>
   safe void foo() { # BTW I'd highlight the replacement in color too<br>
y/n/yes to all/no to all? yes to all<br>
<br>
boom<br>
</blockquote></div><br></div>