Skip to content

Commit ff26160

Browse files
committed
[spec/expression] Improve AssignExpression docs for arrays
Differentiate between an a slice expression and assigning to an array. Rename 'Array Setting' to 'Array Filling' and tweak wording.
1 parent b8dddee commit ff26160

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

spec/arrays.dd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,12 @@ assert(s == [2, 3, 3, 4]);
418418
)
419419

420420

421-
$(H2 $(LNAME2 array-setting, Array Setting))
421+
$(H2 $(LNAME2 array-setting, Array Filling))
422422

423423
$(P If a slice operator appears as the left-hand side of an assignment
424424
expression, and the type of the right-hand side is the same as the
425-
element type of the left-hand side, then the array contents of the
426-
left-hand side are set to the right-hand side.
425+
element type of the left-hand side, then each element of the slice
426+
expression will be assigned to the value on the right-hand side.
427427
)
428428

429429
$(SPEC_RUNNABLE_EXAMPLE_RUN

spec/expression.dd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,13 @@ $(H3 $(LNAME2 simple_assignment_expressions, Simple Assignment Expression))
384384
as described in $(DDSUBLINK spec/arrays, resize, Setting Dynamic Array Length).
385385
)
386386

387-
$(LI If the lvalue is a static array or a slice, the behavior is as
387+
$(LI If the left operand is a slice expression, the behavior is as
388388
described in $(DDSUBLINK spec/arrays, array-copying, Array Copying) and
389-
$(DDSUBLINK spec/arrays, array-setting, Array Setting).
389+
$(DDSUBLINK spec/arrays, array-setting, Array Filling).
390+
)
391+
392+
$(LI If the lvalue is an array, the behavior is as described in
393+
$(DDSUBLINK spec/arrays, assignment, Array Assignment).
390394
)
391395

392396
$(LI If the lvalue is a user-defined property, the behavior is as

0 commit comments

Comments
 (0)