Re: forall and do loop



On Jul 31, 1:41 am, glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:
Richard Maine wrote:
glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:
If I designed FORALL I would have allowed intermixing of evaluation
and assignment in any order, and left it to the programmer to be sure
that would work.
That amounts to restricting it to the cases trivial enough that most
compilers probably don't generate temporaries today anyway. So you'd get
the same effect as today on that subset of cases, and you'd just say
that the other cases were illegal. Anyway, that's how I'd translate the
above.

That is pretty close to what I meant. I think there are some cases
of indirect loads that the compiler wouldn't catch, though.

FORALL (I=1:N) X(I)=X(L(I))

the programmer might know that no X() from the right side are
modified, but the compiler likely wouldn't. (That all L() were
greater than N.)

What about introducing an "unaliased assignment" (say, := or sth),
that would allow the programmer to guarantee that the left-hand side
is completely independent of right-and side? In case of forall, that
would of course apply to the whole sets of lhs's and rhs's.
Easily understandable and has the same effect, hasn't it?

.


Quantcast