Dave Rolsky wrote:
> 
> On Tue, 19 Aug 2003, Flavio S. Glock wrote:
> 
> > > > There are some cases when we don't know if a recurrence has any event at
> > > > all.
> > > > This may happen when you do an intersection of recurrences.
> > > > Otherwise, if they don't have a start and end, they are infinite, right?
> > > > But 'undef' is ok - I'll change that.
> > >
> > > Well, the set may not have a start or end, but it's quite possible that
> > > the callback may simply not return anything before or after certain
> > > datetimes.
> >
> > I think this would give an error, in current implementation.
> > If a recurrence ends, it must have an explicit 'end' date.
> 
> If we want to document and specify that this is an error, then the size
> should be infinite.  Otherwise, if we might want to allow this in the
> future, undef is correct.  I don't feel too terribly strongly either way.

Ok. So let's document that it is an error.

Note that DateTime::Set 0.10 changes the way sets are 'counted'.

DateTime::Set has quite a variety of internal types of sets:

  1 - simple list of dates.
  2 - plain recurrence.
  3 - recurrence with start date _or_ end date.
  4 - recurrence with start _and_ end dates.
  5 - function of recurrences.

In sets of type 1, the count is a plain number;

Sets of type 2 and 3 have an 'infinite' count;

Sets of type 4 are 'huge sets'. These have an 'unknown' count. The count
can be thousands or even millions of dates, but it is not infinite.
Before version 0.10, you would run out of memory if you specified
something like "all seconds in the century".
Now, the program will just go on normally - it creates a 'huge set'. And
it doesn't attempt to count the set elements.

Sets of type 5 can have either an infinite or an unknown count:
intersections always have 'unknown' count; unions are infinite if both
sets are infinite.

How about: return 'infinity' when we _know_ the set is infinite, and
return 'undef' when we don't know how big the set is.

- Flavio S. Glock

Reply via email to