On Thu, Jan 6, 2011 at 3:47 AM, Carl Jokl <[email protected]> wrote:
> One item which I have heard mention recently is that the for loop
> syntax is potentially harmful to teach because the for loop with an
> index is inherently only processable with a single thread vs the
> foreach loop which can potentially use parallel processing.
>
This seems wrong. Just because the loop seems to be parallelizable doesn't
mean it is. The compiler needs to know whether your iteration is ordering
sensitive or not ("Is it okay if index 3 is treated before index 1?"). This
hint is much more meaningful than whether the developer is using an index of
foreach. The same applies to closures, LINQ or whatever comprehension
walking mechanism you favor.
--
Cédric
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.