[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jun 22 11:08:33 1998 
Subject:Re: New -for- loop construct [long, revision 2, request for comments] 
From:David S Young 
Volume-ID:980622.03 

It sounds like a good idea, but I think that it should be possible for
variables used for write-back NOT to be set at the start of the loop.

One reason is efficiency. Say you want to fill a vector with random
numbers with something like

	lfor i in update vector v do
	    random(1.0) -> i
	endfor;

then there's no need to spend time accessing the vector to set i before 
the call to random. 

Another reason is that it might not always be sensible to read from the
structure - for example you might want to feed values to a consumer
which only had an updater - something like

	lfor i, j in list l, update repeater v do
	    foo(i) -> j
	endfor

and you only want to call the updater of v.

Perhaps it should be possible for loop variables to come in 3 kinds: 
read (as in most current for loops), write (as in update variables in
*in_array) or read/write (as proposed for update variables in lfor)? 

David Young