Compiler updating user code

John Colvin john.loughran.colvin at gmail.com
Fri Mar 14 05:31:24 PDT 2014


On Friday, 14 March 2014 at 12:23:01 UTC, Manu wrote:
> On 14 March 2014 22:07, John Colvin 
> <john.loughran.colvin at gmail.com> wrote:
>
>> On Friday, 14 March 2014 at 11:44:21 UTC, Daniel Murphy wrote:
>>
>>> "Manu" <turkeyman at gmail.com> wrote in message
>>> news:mailman.105.1394774104.23258.digitalmars-d at puremagic.com...
>>>
>>>  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.
>>>>
>>>> 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.
>>>>
>>>> Imagine instead, an '-update' option which instead of 
>>>> modifying your
>>>> code, would output a .patch
>>>> file containing suggested amendments wherever it encountered 
>>>> deprecated
>>>> code...
>>>> 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.
>>>>
>>>> I would say this approach takes a dubious feature and turns 
>>>> it into a
>>>> spectacular feature!
>>>>
>>>
>>> If you're using version control, these are practically the 
>>> same thing.
>>>
>>
>> Yeah, I don't understand why it matters whether it's a change 
>> or a patch.
>> Either way, all changes become patches in VCS. Who would let 
>> an automated
>> tool make source changes without using VC, or at least having 
>> made a manual
>> backup?
>>
>
> Because Walter is acutely allergic to the idea of a tool that 
> modifies your
> source code. I might also have uncommitted changes, and not 
> particularly
> feel like stashing them for the moment (less easy in other 
> VCS's).
> I might also not want to apply all the changes, only some of 
> them. Surely
> it's easier to merge the ones I want after visual approval, 
> than reverting
> the ones I don't want after having gone to the effort of 
> stashing my local
> changes to make a clean slate to work with...
>

I appreciate it would be convenient, but changing compiler 
versions and patching up the code is a major enough update to 
justify a branch IMO, let alone just a commit or stash.

Anyway, I don't think it matters that much either way.

Admittedly my experience is limited to git and mercurial, both of 
which deal with these sorts of situations trivially.

> Also, making a direct change allows the user to use whatever 
> diff software
>> / version control software they like.
>>
>
> I'm not sure how a patch file restricts them to a particular 
> merge program
> or VCS...

I suppose not. I was assuming that there might be different 
standards for patch files.


More information about the Digitalmars-d mailing list