comparison etc/NEWS.7.md @ 31071:f03902a39810 stable

NEWS.7.md: Reword note about changes to parsing command style syntax (bug #62552).
author John W. Eaton <jwe@octave.org>
date Sun, 05 Jun 2022 13:35:18 +0200
parents 505ec2f4e16f
children 396f60e0b984 7060de0b45e5
comparison
equal deleted inserted replaced
31069:43974344fe19 31071:f03902a39810
146 - The increment and decrement operators `++` and `--` must "hug" their 146 - The increment and decrement operators `++` and `--` must "hug" their
147 corresponding variables. In previous versions of Octave, whitespaces 147 corresponding variables. In previous versions of Octave, whitespaces
148 between these operators and the variable they affect were allowed. That 148 between these operators and the variable they affect were allowed. That
149 is no longer the case. 149 is no longer the case.
150 150
151 - When an expression involving operators could be interpreted ambiguously 151 - Parsing of command-style function calls has changed to improve
152 either as command style syntax or function style syntax, it is 152 consistency of behavior and compatibility with Matlab. This change
153 interpreted as command style syntax in more cases than in previous 153 affects statements that begin with binary operator expressions when the
154 versions. To still be interpreted as function style syntax, inplace 154 first operand is a plain symbol followed by a whitespace character and
155 operators (`+=`, `-=`, `*=`, `.*=`, `/=`, `./=`, `\=`, `.\=`, `^=`, 155 the binary operator is not followed by a whitespace character. For
156 `.^=`, `|=`, `&=`) must now either be followed by a whitespace character 156 example, the statement `cmd -option` is parsed as a command-style
157 or must not be preceded by a whitespace character. For ambiguous 157 function call, not a binary subtraction operation.
158 expressions involving binary operators (`+`, `-`, `*`, `.*`, `/`, `./`, 158
159 `\`, `.\`, `^`, `.^`, `|`, `&`, `||`, `&&`), the same rules apply. 159 This change affects all binary operators: `+`, `-`, `*`, `/`, `\`,
160 E.g., `a + b`, `a+ b`, or `a+b` are valid expressions if `a` is a 160 `^`, `.*`, `./`, `.\`, `.^`, `|`, `&`, `||`, `&&`, `+=`, `-=`, `*=`,
161 variable. In contrast, `a +b` will throw an error if `a` is a variable. 161 `/=`, `\=`, `^=`, `.*=`, `./=`, `.\=`, `.^=`, `|=`, and `&=`.
162 The latter example is now interpreted as a command syntax expression 162
163 (equivalent to the function syntax expression `a ("+b")`). 163 Previous versions of Octave would attempt to determine whether the
164 first operand in an expression was a variable, and if so, parse
165 expressions like `var -val` as an expression. However, this attempt to
166 "do the right thing" could cause trouble (for example, if a variable is
167 only defined conditionally).
168
169 Now, parsing command-style function calls is purely based on syntax.
170
171 Command-style function call syntax is only allowed at the beginning
172 of a statement. Expressions in other contexts are not affected, so an
173 expression like `a + b +c` will not be parsed as a command-style function
174 call.
175
176 For compatibility with Matlab, a binary expression at the beginning
177 of a statement that starts with one of the symbols `I`, `i`, `J`, `j`,
178 `Inf`, `inf`, `NaN`, `nan`, or `pi` is never parsed as a command-style
179 function call. Octave also extends this behavior to `e`, which is not
180 present as a special numeric constant in Matlab.
181
182 Note that full compatibility with Matlab, which does not have the
183 OP= operators, would require that even `a -= b` is parsed as a
184 command-style function call. As that would significantly hinder the use
185 of these operators, Octave treats them as the other binary operators
186 instead of providing fully compatible behavior.
164 187
165 - The `mldivide` function (i.e., the `\` operator) now uses an LU 188 - The `mldivide` function (i.e., the `\` operator) now uses an LU
166 decomposition to solve nearly singular full square matrices. This is 189 decomposition to solve nearly singular full square matrices. This is
167 Matlab-compatible and yields results which more nearly minimize `norm 190 Matlab-compatible and yields results which more nearly minimize `norm
168 (A*x - b)`. Previously, Octave computed a minimum-norm solution. 191 (A*x - b)`. Previously, Octave computed a minimum-norm solution.