On Sun, Jan 27, 2013 at 1:05 AM, Mark Morgan Lloyd
<markmll.fpc-de...@telemetry.co.uk> wrote:
> Sven Barth wrote:
> Some way of extending a single value to fill a tuple where all the elements
> are of the same type would be useful, note that I'm not suggesting any other
> relaxation of type checking.
>
> (x, y, z) := (0, 0, 0);         // OK
> (x, y, z) := Tuple(0);          // OK
> (x, y, z) := (0, 0);            // Not OK
> (x, y, z) := Tuple(0, 0);       // Not OK
>
> So if I understand things correctly, brackets [] are used where the number
> of contained elements is indeterminate (sets, multidimensional array
> indices, arrays of const) and parentheses where it's determinate (tuples,
> record initialisation etc.).
>

Note that in my proposal I suggested to allow array deconstruction and
ignoring extra elements on the right side,
so mass initialization may be implemnted by something like this:
const
  ZEROES: array [1..10] of Integer = (0, 0, ..., 0);
...
(x, y, z) := Tuple(ZEROES);
alternatively:
function Repeat(AValue: Integer; ACount: Integer = 10): TIndegerDynArray;
...
(x, y, z) := Tuple(Repeat(777));

Anyway, I do not think mass-assignment of the same value is
particularly important
compared to the general case of mass-assignment of arbitrary values.

--
Alexander S. Klenin
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to