At 11:54 AM +0100 9/2/06, Daniel Stenning wrote:
That's the whole point of the "for each" not using ( or even providing ) a
counter. Something I was put right on by RS a while back when I (mistakenly)
put in a request to have RB provide the internal loop counter in For Each to
the program on request.

That was just a simple example to show the general problem.

There are many current uses of For Each that implicitly depend on serial execution, all of which would break if For Each was parallelized. Phil Mobley pointed out another...

At 7:48 PM -0700 9/1/06, Phil M wrote:
Consider this function:

  Function Average(d() As Double) As Double
    Dim r As Double
    For Each e As Double In d
      r = r + e
    Next
    Return r / (UBound(d) + 1)
  End Function

If the "r" variable needs to be locked with a Semaphore, it kinda defeats the purpose of the MP thread.

The general problem with parallelizing For Each stands. The RB language and most RB users, including me, aren't equipped to handle parallelization within a single thread.

And if parallelization IS to be added I'd suggest using a new construct since I'd venture to say that much of the existing For Each code already implicitly depends on the independent serial execution of each case even if the coder remembered the admonition that the items may not execute sequentially from the In array.

Regards,
Joe Huber
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to