Welcome to This Week in D! Each week, we'll summarize what's been going on in the D community and write brief advice columns to help you get the most out of the D Programming Language.
The D Programming Language is a general purpose programming language that offers modern convenience, modeling power, and native efficiency with a familiar C-style syntax.
This Week in D has an RSS feed.
This Week in D is edited by Adam D. Ruppe. Contact me with any questions, comments, or contributions.
See more at the announce forum.
This week's tip is from Basile.
D tooling lacks a good, reliable thing to refactor the code. However one of the most used refactoring operation, which is to rename an identifier or a type, can be done directly using the compiler.
Imagine that you have a struct Old{} that you want to rename to New.
- rename the old symbol: struct New {}
- deprecate and alias the old symbol: deprecated alias Old = New;
- compile the projects that depended on Old. In the messages you'll get the lines where you have to patch Old to New.
While the changes must be done by hand you'll have a least the guarantee of the symbol correctness, unlike when a simple replace all operation is performed.
To learn more about D and what's happening in D: