Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [date date! month month-bounds] MONTH-BOUNDS func design

From: gregg::pointillistic::com at: 28-Jan-2008 16:08

Hi Carl, and Ed, EOC> If you're building this as part of a larger set of functions, let us EOC> know. Dates are a great candidate for dialects. Yes, this is the motivation. I have a library of date related functions, and BOUNDS and RANGE funcs that can deal with dates. If we have a good set of funcs, and design them for easy use on their own, or from a dialect, it would give us great flexibility. Another example question, which I almost posted as the primer question on this topic, is whether a LEAP-YEAR? func should always require a year, or should it default to the current year, and use a refinement if you want a different year. And the same question for MONTH-BOUNDS applies to WEEK-BOUNDS. EOC> Reaching back to my smalltalk days, I recall that they had a lot of EOC> nice classes that helped with calendars. The methods DaysInMonth and EOC> CalendarForMonth come to mind, iirc. I have DaysInMonth already, and a lot of others, e.g. same-day-last-month, year-week, weeks-in-year, week-bounds. And a copy of Ed's calc-workdays funcs. :) CR> Why are two values even required? Is there any month that doesn't CR> start on the 1st? It's useful to be able to get the last day of a CR> month since they vary, but I don't see the need for returning CR> a block with the first as well in it. EOC> Don't we always know what the date of a given month is? And the EOC> start time/end times for any month? :^) Starting today, what do you have to do to get a list of all dates in the current month? Or how do you compare a date to see if it was last month, or in any given date range? That is, how can we best express the abstraction of date and time ranges? For a monthly calendar display, you need just the dates. For a scheduler that gives you daily and weekly views, you need more detail. In the case of month-bounds, let's say a user can say "find me all the files that were added/updated between x and y". Given dates, or just a month name (files updated in jan-2008), we need the time detail to catch everything. -- Gregg