DIP65: Fixing Exception Handling Syntax

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 17 16:52:15 PDT 2014


On Thu, Jul 17, 2014 at 11:39:56PM +0000, bearophile via Digitalmars-d wrote:
> Walter Bright:
> 
> >BTW, it's not perfect because of token string literals and string
> >mixins, but it's good enough.
> 
> In general the creation of a tool like Go fix
> (http://golang.org/cmd/fix/ ) for D could change a little the
> trade-offs regarding the tiny Phobos/D breaking changes.
[...]

This got me thinking, if dmd came with a -fix option, perhaps, that will
either automatically fix your code or print out a list of suggested
fixes, then perhaps breaking changes might be more palatable?

For example:

1) I install dmd 2.065, and write my project according to it.

2) I see that 2.066 has been released, so I download and install it.

3) When I try to compile my project, it tells me:

	yourcode.d(123): deprecated syntax, please run with -fix to
	automatically correct it, or -d to compile according to 2.065
	syntax.

4) I don't have time to verify the fixes at this time, so I run dmd with
-d to get my product out the door.

5) 2 weeks later, I have some free time, so I run dmd -fix on my code to
upgrade to the new syntax. Then I review the changes and approve them.
Or, alternatively, I run dmd -fix -diffonly to see what the compiler's
suggestions of changes are, and modify my code by hand accordingly.

6) Now I can compile with "native" 2.066 mode.


Once this pattern becomes established, it can be simplified into just:

1) Install 2.065. Compile my project.

2) Upgrade to 2.066.

3) Run dmd -fix (upgrade syntax after each compiler upgrade).

4) Compile my project as before.

5) ... ditto


T

-- 
If the comments and the code disagree, it's likely that *both* are wrong. -- Christopher


More information about the Digitalmars-d mailing list