<div dir="ltr">So it comes up fairly regularly that people suggest that the compiler should have a mode where it may update user code automatically to assist migration to new compiler versions.<div><br></div><div>I'm personally against the idea, and Walter certainly doesn't like it, but it occurred to me that a slight variation on this idea might be awesome.</div>
<div><br></div><div>Imagine instead, an '-update' option which instead of modifying your code, would output a .patch file containing suggested amendments wherever it encountered deprecated code...</div><div>The user can then take this patch file, inspect it visually using their favourite merge tool, and pick and choose the bits that they agree or disagree with.<br>
</div><div><br></div><div>I would say this approach takes a dubious feature and turns it into a spectacular feature!</div><div><br></div><div>Language changes are probably easy enough to handle, but what about cases of 'deprecated' in the library?</div>
<div>It's conceivable that the deprecated keyword could take an optional argument to a CTFE function which would receive the expression as a string, and the function could transform and return an amended string which would also be added to the output patch file. This way, the feature could conceivably also offer upgrade advice for arbitrary library changes.</div>
<div><br></div><div>Considering the advice in the context of a visual diff/merge window would be awesome if you ask me.</div></div>