Oops. There was an error in my example, I didn't
truncate the second return value.
> Why does the DateTime::Set class need to get both
dates back? I think that's what is confusing me.
It needs 'random access' to the recurrence, such that
it can construct the set of ocurrences for a given
span. The return values mean:
#0 = 'current' value - this is the actual 'result'.
#1 = 'next' value - this value will be fed to the
callback recursively, such that we can get all the
values in a given span.
This has the same effect of defining a
previous()/next() function pair, or defining a
truncate()/next() function pair.
For example: get results for current year:
current = 2003
next = 2004
$callback(next) gives:
current = 2004
next = 2005
If you had just 1 return value you would get:
result = 2004 ("next" only!)
$callback(next) gives:
result = 2005
In the second case, you have no way to find out the
"2003" result, because it comes _before_ today, and
you can only get results _after_ today.
- Flavio S. Glock