Timothy S. Nelson wrote: > Should laziness/eagerness be a property of the operator?
I'm inclined to believe that the level of lazyness or eagerness is determined by the operators in question, at least that had worked for assignment and feeds, I can't think of a case where something else determines the lazyness > You write "The iterator role represents the lazy access to a list". > Why only lazy access? It's not *only* lazy access, but it's how you do lazy access... > You write: my $item = =$foo; > Does that get one item from the iterator object? It depends on the iterator in question, but it certainly gets something (unless the iterator is over, of course), I'm thinking on the following: my $iterator = @list.Iterator(); my $capture = =$iterator; # this returns the capture for that iteration; but my $iterator <== @list; my $item = =$iterator; # this returns one, and only one, item This is important because my @@slice <== @list; Will keep the dimensionality between iterations and items, for instance: my @@slice <== map { $_ == 2 ?? ( 1, 2, 3 ) !! () }, 1, 2, 3; the slice would contain ( () ; ( 1,2,3 ); () ) And this is possible because the actual Iterator returned by the list returns capture-by-capture on each iteration. > you specify that the .Iterator() object on something that does List > will return the appropriate iterator. I changed it to be .iterator() (so > that > it's lowercase like all the other List.whatever() functions); what's the > function signature? The Uppercase is used to indicate a type coercion, the standard way of coercing something to some other type is by calling a method of the name of the type in that object, that's why you have .Iterator on list, and usually this method has no parameters. daniel