Walter's Guide to Translating Code From One Language to Another

Walter Bright newshound2 at digitalmars.com
Fri Sep 21 06:00:33 UTC 2018


I've learned this the hard way, and I've had to learn it several times because I 
am a slow learner. I've posted this before, and repeat it because bears repeating.

The procedure is:

1. pass the test suite
2. prep the file for conversion, i.e. try to minimize the use of idioms that 
won't easily translate
3. pass the test suite
4. translate the code with as few edits as practical. Do not reformat the code. 
Do not refactor it. Do not fix anything, no matter how tempting. Reproduce the 
behavior of the original as much as possible.
5. pass the test suite
6. now reformat, refactor, fix (as separate PRs, of course, and passing the test 
suite in between each).
7. pass the test suite

Note that without a test suite, you're doomed :-)


More information about the Digitalmars-d mailing list