> tmp in FOR EACH is only reference.
> Why we should create variable for such reference in FOR EACH
> but not in function call?, i.e.:
> 
>   func( @tmp )
>   ? tmp
> 
> 'tmp' is also "a written variable" like in above both cases.
> 
> Of course if most of Harbour users prefer to create new memvar
> variable in FOR EACH then I'll implement it but I do not like it.
> 
> But do not forget that FOR EACH does not store dummy references
> after iteration but restores original variable value.
> 
>   proc main()
>      x := 10
>      ? x
>      for each x in "ABC"
>         ? x
>      next
>      ? x
>   return
> 
> Personally I even think that FOR EACH should use their own temporary
> variables instead of declared ones. It will be much cleaner and faster.

Sounds reasonable. BTW for this is not a problem, but I've 
personally stumbled into this quite a few times (when 
creating small quick test code without -w switch) and 
found it non-natural. Anyway it's not huge problem for 
me and I can accept this explanation.

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to