> I was thinking of something like this actually:
>  my $iterator = $set->iterator
>  while ( my $dt = $iterator->next ) { ... }
> 
> The iterator() method may need to take some 
parameters, like "start" and "end" for infinite sets, 
as well possible a direction parameter as well.
> It will return an object of the 
DateTime::Set::Iterator class, though it's possible 
there will be a need for multiple subclasses of that 
class (I don't know yet).
> 
> BTW, how does Set::Infinite decide the "min" and 
"max" elements for an infinite set?  Obviously, min 
and max methods for the set are useful.
> Does DateTime::Set get that for free from 
Set::Infinite?

Yes, min and max are already there.

Getting min/max of an infinite set is not a problem: 
if the set is unbounded you get infinity, otherwise 
you get a number. 

Set::Infinite does backtracking to solve more complex 
cases, like when you have intersections/unions of 
infinite sets. It might also return undef, meaning 
"don't know".

By "multiple subclasses", do you mean 
DateTime::Set::Iterator, DateTime::Span::Iterator, 
DateTime::SpanSet::Iterator ?

I don't think we need start/end parameters, because 
you could use a DateTime::Span for that purpose. 

I'd use next/previous methods instead of a direction 
parameter (but I've never needed 'previous').


Reply via email to