Ticket #78 (closed defect: wontfix)

Opened 3 years ago

Last modified 3 years ago

Fix iterator behavior

Reported by: mooneer Owned by: mooneer
Priority: major Milestone:
Component: interpreter Version:
Keywords: Cc:

Description

Iterators aren't as intuitive as in other languages. This should be fixed.

Change History

comment:1 Changed 3 years ago by mooneer

  • Status changed from new to closed
  • Resolution set to wontfix

Reviewed the current iterator behavior. It's as follows:

reset = point iterator to first element. Do not return a value.
cur = return null if at the end of the list, or if not initialized. Else print current value of iterator.
next = return true if there was another element and we've moved to it, false otherwise.

This means something like this:

lst = [1,2,3];
lst|reset;
while(not (lst|cur is System.null)) [
   lst|cur|print;
   lst|next;
];

which is acceptable. Will not fix.

Note: See TracTickets for help on using tickets.