Skip to content

Commit 79b4997

Browse files
authored
Update the evolution doc for 1.31 range changes by vass (#22566)
This PR updates the Chapel Evolution document for the change range.stridable --> strides: strideKind in #22441 / #22486 / #22508 and for the change range.boundedType to range.bounds in #22059. r: @benharsh
2 parents 829e39f + 79d2f8e commit 79b4997

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

doc/rst/language/evolution.rst

+77
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,83 @@ The purpose of this flag is to identify portions of a program that use a
1414
language or library feature has recently changed meaning or which is
1515
expected to change meaning in the future.
1616

17+
version 1.31, June 2023
18+
-----------------------
19+
20+
Version 1.31 renames and adjusts two of range's parameters,
21+
formerly ``range.boundedType`` and ``range.stridable``,
22+
as well as the former domain parameter ``domain.stridable``.
23+
For details please see `Range Types` in the online documentation for `Version 1.30 <https://chapel-lang.org/docs/1.30/language/spec/ranges.html#range-types>`_ and `Version 1.31 <https://chapel-lang.org/docs/1.31/language/spec/ranges.html#range-types>`_.
24+
25+
Range boundedType / bounds parameter
26+
************************************
27+
28+
Prior to Version 1.31, the boundedness of a range ``r`` was determined
29+
by ``r.boundedType``. As of 1.31, it is determined by ``r.bounds``.
30+
At the same time, the type of this field changed from:
31+
32+
.. code-block:: chapel
33+
34+
enum BoundedRangeType { bounded, boundedLow, boundedHigh, boundedNone };
35+
36+
to:
37+
38+
.. code-block:: chapel
39+
40+
enum boundKind { both, low, high, neither };
41+
42+
This change helps make Chapel code shorter, improving its readability.
43+
44+
When updating your code, simply update the names accordingly. For example,
45+
from:
46+
47+
.. code-block:: chapel
48+
49+
if myRange.boundedType == BoundedRangeType.boundedLow then ....;
50+
51+
to:
52+
53+
.. code-block:: chapel
54+
55+
if myRange.bounds == boundKind.low then ....;
56+
57+
Range and domain stridability / strides parameter
58+
*************************************************
59+
60+
Prior to Version 1.31, ranges and domains had the parameter ``stridable``,
61+
which was a boolean that indicated whether the given range or domain
62+
allowed non-unit strides.
63+
As of 1.31, this parameter is replaced with ``strides`` whose type is:
64+
65+
.. code-block:: chapel
66+
67+
enum strideKind { one, negOne, positive, negative, any };
68+
69+
This change creates additional opportunities for optimization,
70+
for example in the cases where the range's stride is known at compile time
71+
to be positive or to be -1.
72+
This also avoids a terminology problem where ``stridable=false`` implied,
73+
incorrectly, that a range could not be strided. The ``strides`` values
74+
are now self-explanatory instead of the non-specific values
75+
``true`` and ``false``.
76+
77+
When updating your code, update the field name and replace boolean
78+
values with enum values. For example:
79+
80+
=============================== =============================================
81+
change from... to...
82+
=============================== =============================================
83+
``myRange.stridable`` ``myRange.strides``
84+
``if myRange.stridable then`` ``if myRange.strides != strideKind.one then``
85+
``range(stridable=false)`` ``range(strides=strideKind.one)``
86+
``range(stridable=true)`` ``range(strides=strideKind.any)``
87+
another potential replacement: ``range(strides=strideKind.positive)``
88+
=============================== =============================================
89+
90+
When getting an error like "assigning to a range with boundKind.positive
91+
from a range with boundKind.any", insert a cast to the desired range type.
92+
Analogous updates are needed in code operating on domains.
93+
1794
version 1.28, September 2022
1895
----------------------------
1996

0 commit comments

Comments
 (0)