C11.1.4) Reference assignment of repetitions
Description
This article is from the FAQ, by with numerous contributions by
others.
C11.1.4) Reference assignment of repetitions
Consider the following example:
ORIGIN '~beta/basiclib/v1.6/betaenv';
--- program: descriptor ---
(# P0: (# #); P1: P0 (# #);
R1: [5] ^P0;
R2: [5] ^P1;
do R1[]->R2[]; (*not legal*)
#)
It is not legal to assign a repetition reference to another repetition
reference. Unfortunately the compiler does NOT catch this error. The program
compiles and gives unpredictable results when executed.
It is possible to have the following assignment
R1->R2
which makes R2 be a copy of R1. But R1 and R2 do not refer to the same
repetition.
Note, it is of course possible to have the elemenst of R1 point to the same
elemenst as P1:
(for i: R1.range repeat R1[i][]->R2[i][] for)
It would be possible to extend BETA to allow assigning a reference to a
repetion object to another reptition, but there are currently no plans for
this.
 
Continue to: