
On Behalf Of Jeff Garland Subject: Re: [boost] date-generators (was Date-Time)
On Mon, 19 Apr 2004 14:22:53 -0400 (EDT), Rob Stewart wrote
That does make sense, but so does the "date wrapper" idea. The latter provides a convenient means to use operator overloading meaningfully while making the behavior of those operators specific to the wrapper type. I think the date wrapper approach will prove easier to use, but more cumbersome to implement.
I have no idea what the 'date wrapper approach' is...
Jeff
Some further quick thoughts from my dark past... Most places I've been, typically finance related, have had dates, date expressions, date generators and calendars as concepts. Date expressions give you the concept of the last day of the month. They can give you the third Wednesday of the month. I'm used to just strings like: 3wed+2b (3rd Wednesday + 2 business days), -1Sun+1b (Last Sunday + next business day), -1d (last day of the month). Strikes me that date expressions would look nice as expression templates. Extend this with date generators that can generate such dates for month patterns (every 3 months, explict months) within the context of a calendar. Calendars with holidays and being able to combine them for transactions is important. You can then refer to the second business day after the third Wednesday and such things. A typical use of a calendar is to have calendars for business jurisdictions and be able to union them. The usual implementation I've used is a bit field of days of the year for however many years, though a holiday list and look up might make more sense. A default "Western" calendar only has Sat,Sun as non-business days. Date expressions can get interesting when you're trying to represent various business rules, e.g. -Sun+2b unless it is less than 3 days before the end of the month then it is -Sun-1b, which can lead you down the path of extending the syntax to include comparisons, conditional representation and the notion of "instance". E.g (-sun+2b) <= -3d ? (-sun+2b) : (-sun-1b). Now that's fun :-) Once place I worked had easter, the lunar calendar and the like to do some further unusual stuff. Adding something to a date could be a date expression: 1. date_add( date(2004,2,29), "+3M : -d") // 31 May 2004 2. date_add( date(2004,2,29), "+1M : -0b") // 29th Mar if a business day, previous b day if not one Hmmm, I forget how that bit used to work, but you get the idea... Generate a date or dates from some specification, the last day of the month is a simple specification. $0.005 Matt Hurd. IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.