How would you get the dreamed DRY ideal in this sample, in the language of your choice:
drawLine(Point(0, 0), Point(w, 0));
int curRowY = 0;
for(int row=0; row<rowHeights.size(); row++) {
curRowY += rowHeights[row];
drawLine(Point(0, curRowY), Point(w, curRowY));
}
drawLine(Point(0, 0), Point(0, h));
int curColX = 0;
for(int col=0; col<colWidths.size(); col++) {
curColX += colWidths[col];
drawLine(Point(curColX, 0), Point(curColX, h));
}
Note: A multitude of ad-hoc preprocessor macros is likely to be extremely less readable&writable so that's out.