Closed lucasborin closed 3 years ago
ABAP's missing boolean type means type coercion is involved in any assignment to a pseudo-boolean variable, which can be erroneous without a syntax error. Pining it on Chained Assignments is IMO a misnomer. as the issue also appear if we just write
c = a.
in the code above. It is boolean assignments without the xsdbool( ) or boolc( ) functions that should be scrutinized/discouraged.
My use case for Chained Assignments is saving a temp while traversing the nodes of a linked list.
In my opinion: avoid using chained assignment in all cases, its rarely used in actual code, and easy to work around
Thread started here: https://github.com/SAP/code-pal-for-abap/issues/398
As represented in the above code, a user can confuse the chained equal signs. Is it assigning the values? Is it comparing
a
andb
?Should I enhance the style guide by asking people to avoid chained equals signs when the target attribute/variable is a boolean? Please, feel free to share your thoughts.
Ps: It is an assignment. Therefore,
c
(which is char1 technically) will receiveb
's value.