
From: "Powell, Gary" <powellg@amazon.com>
Rob wrote:
Ok, but you need more than just LAST, you need LAST-1, LAST-2, and LAST-3
Why? I can't imagine a good use case for wanting one, two, or three days before the end of the month as a special form of date.
To make this work:
date d = January LAST-1; // the 30th
add_month(d); d == February 27th or 28th depending on the leap year,
add_month(d); d == March 30th;
Ummm, OK, you made it work, but why? Why would you want to be able to call add_month() on a date and have it always represent the day before the last day of the month?
Which is why the specialized function is the way to go. LAST isn't enough and anything else is cumbersome, buggy and hard to maintain.
I don't see why you need more than LAST thus far. If there is a good use case for this idea that has general appeal, then I agree with you, it becomes quite cumbersome. However, does that mean that LAST itself isn't valuable? Put another way, if there is value in LAST-1 et al, how often would they be wanted relative to the desire for LAST? -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;