Proposal idea - generators
neal at gafter.com
Wed Apr 1 17:20:43 PDT 2009
On Wed, Apr 1, 2009 at 4:13 PM, Howard Lovatt <howard.lovatt at gmail.com> wrote:
> My reading of the Scala Language Specification, page 83, is that the for
> loop is translated into a map call (or similar). Therefore whether this is
> lazy or not is an implementation detail. So I think it is valid to eagerly
> evaluate the loop and store the results in a hash map. After all, the
> current Java for loop evaluates eagerly.
Whether a given Iterator used in a Java for-each loop produces its
values eagerly or lazily is an implementation detail of that iterator.
Requiring it to be eager reduces the flexibility.
More information about the coin-dev