Rect trace iterator
The _RectTracer class feels like a bit of a hack, but I don't think there's a way to write this without it (and without changing the signature of trace()).
Anyway, I think this also handles negative widths and heights better, as the old version wouldn't iterate over them at all. I didn't add a test case or mention the negative width/height thing because I'm not sure I understand how they're actually supposed to work if they have a negative width/height.
Thanks for hacking on this!
I didn't add a test case or mention the negative width/height thing because I'm not sure I understand how they're actually supposed to work if they have a negative width/height.
I think Rect's constructors should just throw an ArgumentError if you give them negative dimensions.